diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2012-03-27 16:15:21 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2012-03-27 16:15:21 -0700 |
commit | 460d2c7c28928ab0d880675c3a7a74e81605e835 (patch) | |
tree | 2083c7e91e7e34ad28441b255744262418ba37e3 /actionpack/lib | |
parent | d82e4c80a820280c8bb9957bd86453d8fea49384 (diff) | |
parent | 6968bc16a1a609c56cf056cd9cd8f8de251defde (diff) | |
download | rails-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')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 5 |
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 |