Permalink
Browse files

Use merge! to avoid a new hash and change some spots to 1.9 hash style

  • Loading branch information...
1 parent c23c193 commit b973852febaac607cb7a602e10b8c04e320822e1 @carlosantoniodasilva carlosantoniodasilva committed Jul 22, 2013
Showing with 7 additions and 7 deletions.
  1. +7 −7 actionview/lib/action_view/helpers/form_options_helper.rb
@@ -384,8 +384,8 @@ def options_from_collection_for_select(collection, value_method, text_method, se
end
selected, disabled = extract_selected_and_disabled(selected)
select_deselect = {
- :selected => extract_values_from_collection(collection, value_method, selected),
- :disabled => extract_values_from_collection(collection, value_method, disabled)
+ selected: extract_values_from_collection(collection, value_method, selected),
+ disabled: extract_values_from_collection(collection, value_method, disabled)
}
options_for_select(options, select_deselect)
@@ -444,7 +444,7 @@ def option_groups_from_collection_for_select(collection, group_method, group_lab
option_tags = options_from_collection_for_select(
group.send(group_method), option_key_method, option_value_method, selected_key)
- content_tag(:optgroup, option_tags, :label => group.send(group_label_method))
+ content_tag(:optgroup, option_tags, label: group.send(group_label_method))
end.join.html_safe
end
@@ -516,7 +516,7 @@ def grouped_options_for_select(grouped_options, selected_key = nil, options = {}
body = "".html_safe
if prompt
- body.safe_concat content_tag(:option, prompt_text(prompt), :value => "")
+ body.safe_concat content_tag(:option, prompt_text(prompt), value: "")
end
grouped_options.each do |container|
@@ -528,7 +528,7 @@ def grouped_options_for_select(grouped_options, selected_key = nil, options = {}
label, container = container
end
- html_attributes = { :label => label }.merge(html_attributes)
+ html_attributes = { label: label }.merge!(html_attributes)
body.safe_concat content_tag(:optgroup, options_for_select(container, selected_key), html_attributes)
end
@@ -565,7 +565,7 @@ def time_zone_options_for_select(selected = nil, priority_zones = nil, model = :
end
zone_options.safe_concat options_for_select(convert_zones[priority_zones], selected)
- zone_options.safe_concat content_tag(:option, '-------------', :value => '', :disabled => 'disabled')
+ zone_options.safe_concat content_tag(:option, '-------------', value: '', disabled: 'disabled')
zone_options.safe_concat "\n"
zones = zones - priority_zones
@@ -748,7 +748,7 @@ def value_for_collection(item, value)
end
def prompt_text(prompt)
- prompt.kind_of?(String) ? prompt : I18n.translate('helpers.select.prompt', :default => 'Please select')
+ prompt.kind_of?(String) ? prompt : I18n.translate('helpers.select.prompt', default: 'Please select')
end
end

0 comments on commit b973852

Please sign in to comment.