1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use new hash syntax

This commit is contained in:
Rafael Mendonça França 2014-10-25 16:14:28 -07:00
parent f28340a5ef
commit b2278aa1a0
2 changed files with 4 additions and 3 deletions

View file

@ -135,15 +135,16 @@ module ActionView
if options.include?(:include_blank)
include_blank = options.delete(:include_blank)
if include_blank == true
include_blank = ''
end
option_tags = content_tag(:option, include_blank, :value => '').safe_concat(option_tags)
option_tags = content_tag(:option, include_blank, value: '').safe_concat(option_tags)
end
if prompt = options.delete(:prompt)
option_tags = content_tag(:option, prompt, :value => '').safe_concat(option_tags)
option_tags = content_tag(:option, prompt, value: '').safe_concat(option_tags)
end
content_tag :select, option_tags, { "name" => html_name, "id" => sanitize_to_id(name) }.update(options.stringify_keys)

View file

@ -233,7 +233,7 @@ class FormTagHelperTest < ActionView::TestCase
end
def test_select_tag_with_include_blank_string
actual = select_tag "places", "<option>Home</option><option>Work</option><option>Pub</option>".html_safe, :include_blank => 'Choose'
actual = select_tag "places", "<option>Home</option><option>Work</option><option>Pub</option>".html_safe, include_blank: 'Choose'
expected = %(<select id="places" name="places"><option value="">Choose</option><option>Home</option><option>Work</option><option>Pub</option></select>)
assert_dom_equal expected, actual
end