aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2016-12-27 12:47:31 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2016-12-27 14:22:36 +0900
commitebeeceeb2aa34d33337f991607debae715ca061a (patch)
tree272a08e0f03952279a1f117ca54743738d58722e /actionview/lib
parent1c2abad7e8eeb6ff480304ad7fe9d18ea7581781 (diff)
downloadrails-ebeeceeb2aa34d33337f991607debae715ca061a.tar.gz
rails-ebeeceeb2aa34d33337f991607debae715ca061a.tar.bz2
rails-ebeeceeb2aa34d33337f991607debae715ca061a.zip
do not mutate `object_name` of class in `fields_for`
Since it affects the entire form, should not mutate `object_name` of class. Fixes #26931
Diffstat (limited to 'actionview/lib')
-rw-r--r--actionview/lib/action_view/helpers/form_helper.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb
index a66a56d441..26a625e4fe 100644
--- a/actionview/lib/action_view/helpers/form_helper.rb
+++ b/actionview/lib/action_view/helpers/form_helper.rb
@@ -1924,10 +1924,11 @@ module ActionView
record_name = model_name_from_record_or_class(record_object).param_key
end
+ object_name = @object_name
index = if options.has_key?(:index)
options[:index]
elsif defined?(@auto_index)
- self.object_name = @object_name.to_s.sub(/\[\]$/, "")
+ object_name = object_name.to_s.sub(/\[\]$/, "")
@auto_index
end