aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/nested_attributes.rb
diff options
context:
space:
mode:
authorArthur Neves <arthurnn@gmail.com>2014-05-24 14:03:30 -0400
committerArthur Neves <arthurnn@gmail.com>2014-05-24 14:55:20 -0400
commit09ac448a8eff73ffb7a3f683207802e8cb1f6d0b (patch)
tree668528eedc99f79d91431c7b7dd6acccd42d5221 /activerecord/lib/active_record/nested_attributes.rb
parente2bd0eb758100a5d6f55201318809a7ed7b37040 (diff)
downloadrails-09ac448a8eff73ffb7a3f683207802e8cb1f6d0b.tar.gz
rails-09ac448a8eff73ffb7a3f683207802e8cb1f6d0b.tar.bz2
rails-09ac448a8eff73ffb7a3f683207802e8cb1f6d0b.zip
Merge pull request #15210 from arthurnn/fix_hbtm_reflection
Fix habtm reflection Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/counter_cache.rb activerecord/lib/active_record/reflection.rb activerecord/test/cases/reflection_test.rb
Diffstat (limited to 'activerecord/lib/active_record/nested_attributes.rb')
-rw-r--r--activerecord/lib/active_record/nested_attributes.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb
index 29ed499b1b..dc9a20fec3 100644
--- a/activerecord/lib/active_record/nested_attributes.rb
+++ b/activerecord/lib/active_record/nested_attributes.rb
@@ -305,8 +305,9 @@ module ActiveRecord
options[:reject_if] = REJECT_ALL_BLANK_PROC if options[:reject_if] == :all_blank
attr_names.each do |association_name|
- if reflection = reflect_on_association(association_name)
+ if reflection = _reflect_on_association(association_name)
reflection.autosave = true
+ reflect_on_association(association_name).autosave = true
add_autosave_association_callbacks(reflection)
nested_attributes_options = self.nested_attributes_options.dup
@@ -542,7 +543,7 @@ module ActiveRecord
end
def raise_nested_attributes_record_not_found!(association_name, record_id)
- raise RecordNotFound, "Couldn't find #{self.class.reflect_on_association(association_name).klass.name} with ID=#{record_id} for #{self.class.name} with ID=#{id}"
+ raise RecordNotFound, "Couldn't find #{self.class._reflect_on_association(association_name).klass.name} with ID=#{record_id} for #{self.class.name} with ID=#{id}"
end
end
end