aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorAndrey Samsonov <andrey.samsonov@gmail.com>2012-03-27 16:30:08 +0400
committerAndrey Samsonov <andrey.samsonov@gmail.com>2012-03-27 16:30:08 +0400
commit7111133371c08d2096cbcffa661860c9ea2c5813 (patch)
tree5565252684578cd38a178b64fdd7cb8001bb1656 /actionpack/lib
parente31ec4700b9e1ca4726cff46fd68442fd6364b7b (diff)
downloadrails-7111133371c08d2096cbcffa661860c9ea2c5813.tar.gz
rails-7111133371c08d2096cbcffa661860c9ea2c5813.tar.bz2
rails-7111133371c08d2096cbcffa661860c9ea2c5813.zip
Fixing issue #2492. 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.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index 2267f3c185..ce8187e870 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -1310,8 +1310,14 @@ 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")