aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2012-03-27 16:15:21 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2012-03-27 16:15:21 -0700
commit460d2c7c28928ab0d880675c3a7a74e81605e835 (patch)
tree2083c7e91e7e34ad28441b255744262418ba37e3 /actionpack/lib/action_view
parentd82e4c80a820280c8bb9957bd86453d8fea49384 (diff)
parent6968bc16a1a609c56cf056cd9cd8f8de251defde (diff)
downloadrails-460d2c7c28928ab0d880675c3a7a74e81605e835.tar.gz
rails-460d2c7c28928ab0d880675c3a7a74e81605e835.tar.bz2
rails-460d2c7c28928ab0d880675c3a7a74e81605e835.zip
Merge pull request #5622 from rafaelfranca/fix-2492-3-2
[3-2-stable] Fix label_tag to merge the options hash with the object hash
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index edca950638..252fe1ed03 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -656,15 +656,16 @@ module ActionView
# 'Accept <a href="/terms">Terms</a>.'.html_safe
# end
def label(object_name, method, content_or_options = nil, options = nil, &block)
+ options ||= {}
+
content_is_options = content_or_options.is_a?(Hash)
if content_is_options || block_given?
- options = content_or_options if content_is_options
+ options.merge!(content_or_options) if content_is_options
text = nil
else
text = content_or_options
end
- options ||= {}
InstanceTag.new(object_name, method, self, options.delete(:object)).to_label_tag(text, options, &block)
end