diff options
author | Andrey Samsonov <andrey.samsonov@gmail.com> | 2012-03-27 17:12:07 +0400 |
---|---|---|
committer | Andrey Samsonov <andrey.samsonov@gmail.com> | 2012-03-27 17:12:07 +0400 |
commit | 6ce0a6de7e698dabcef10b8ebc855b47555d540b (patch) | |
tree | 3d0974ef5eefbd164b760fde83e1bed12cebe1df /actionpack/lib | |
parent | 67b2404cf9b2c7e0f86bf0294571ef97391a6dcd (diff) | |
download | rails-6ce0a6de7e698dabcef10b8ebc855b47555d540b.tar.gz rails-6ce0a6de7e698dabcef10b8ebc855b47555d540b.tar.bz2 rails-6ce0a6de7e698dabcef10b8ebc855b47555d540b.zip |
Fixing issue #2492 for master branch. ActionView::Base.field_error_proc doesn't call for label.
objectify_options method should be applied to the proper options arg.
See explanation and example of the bug - https://github.com/kryzhovnik/rails_field_error_proc_bug_example
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 6219a7a924..ab167e9fa3 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -1117,10 +1117,17 @@ module ActionView @template.fields_for(record_name, record_object, fields_options, &block) end - def label(method, text = nil, options = {}, &block) - @template.label(@object_name, method, text, objectify_options(options), &block) + def label(method, content_or_options = nil, options = {}, &block) + if content_or_options.is_a?(Hash) + content_or_options = objectify_options(content_or_options) + else + options = objectify_options(options) + end + + @template.label(@object_name, method, content_or_options, options, &block) end + def check_box(method, options = {}, checked_value = "1", unchecked_value = "0") @template.check_box(@object_name, method, objectify_options(options), checked_value, unchecked_value) end |