diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2010-08-01 15:52:10 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-08-01 21:51:54 -0300 |
commit | 11614bddc015deff7095bdf8bbe9f11e5d81ae1c (patch) | |
tree | 7a752b536ca821e79b9dd0acffceeaaef76c3ffb /actionpack/lib/action_view/helpers | |
parent | fb0bd8c1092db51888ec4bb72af6c595e13c31fa (diff) | |
download | rails-11614bddc015deff7095bdf8bbe9f11e5d81ae1c.tar.gz rails-11614bddc015deff7095bdf8bbe9f11e5d81ae1c.tar.bz2 rails-11614bddc015deff7095bdf8bbe9f11e5d81ae1c.zip |
Fix label form helper to use I18n and html options, without the need of 'nil' text param:
Before: f.label :title, nil, :class => 'title'
After : f.label :title, :class => 'title'
[#5267 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index f8e60faa2a..ebe055bebd 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -215,7 +215,7 @@ module ActionView # ... # <% end %> # - # If your resource has associations defined, for example, you want to add comments + # If your resource has associations defined, for example, you want to add comments # to the post given that the routes are set correctly: # # <%= form_for([@document, @comment]) do |f| %> @@ -583,8 +583,9 @@ module ActionView # 'Accept <a href="/terms">Terms</a>.' # end def label(object_name, method, content_or_options = nil, options = nil, &block) - if block_given? - options = content_or_options if content_or_options.is_a?(Hash) + content_is_options = content_or_options.is_a?(Hash) + if content_is_options || block_given? + options = content_or_options if content_is_options text = nil else text = content_or_options |