aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/form_helper.rb
diff options
context:
space:
mode:
authorSam Pohlenz <sam@sampohlenz.com>2011-06-20 11:27:04 +0930
committerSam Pohlenz <sam@sampohlenz.com>2011-06-20 11:50:44 +0930
commite69eed0e10c0670869aea396cb79002da4f4580a (patch)
treecd6195d02ececbf7b728ec86afc5f70984e97a85 /actionpack/lib/action_view/helpers/form_helper.rb
parent2df2bfdb4b1165dce4b5bc3fe046147d793fead4 (diff)
downloadrails-e69eed0e10c0670869aea396cb79002da4f4580a.tar.gz
rails-e69eed0e10c0670869aea396cb79002da4f4580a.tar.bz2
rails-e69eed0e10c0670869aea396cb79002da4f4580a.zip
Test for extractable_options? within nested fields_for.
This fixes an error when a record object that is a subclass of Hash is passed to fields_for, which is incorrectly interpreted as field options.
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index 3debc9cc66..0ef2357368 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -1241,7 +1241,7 @@ module ActionView
end
def fields_for(record_name, record_object = nil, fields_options = {}, &block)
- fields_options, record_object = record_object, nil if record_object.is_a?(Hash)
+ fields_options, record_object = record_object, nil if record_object.is_a?(Hash) && record_object.extractable_options?
fields_options[:builder] ||= options[:builder]
fields_options[:parent_builder] = self