aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/autosave_association.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-12-31 20:00:24 +0000
committerJon Leighton <j@jonathanleighton.com>2010-12-31 20:00:45 +0000
commit12675988813e82ac30f7c0e0008c12c4cf5d8cdc (patch)
tree2856d3a21a139d0c182fc5a99724dc49e39d7eb5 /activerecord/lib/active_record/autosave_association.rb
parent3c400627eb9cfac380d716ccf1182d61db4a45a6 (diff)
downloadrails-12675988813e82ac30f7c0e0008c12c4cf5d8cdc.tar.gz
rails-12675988813e82ac30f7c0e0008c12c4cf5d8cdc.tar.bz2
rails-12675988813e82ac30f7c0e0008c12c4cf5d8cdc.zip
Rename AssociationReflection#primary_key_name to foreign_key, since the options key which it relates to is :foreign_key
Diffstat (limited to 'activerecord/lib/active_record/autosave_association.rb')
-rw-r--r--activerecord/lib/active_record/autosave_association.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb
index 4a18719551..c6c1dd8b87 100644
--- a/activerecord/lib/active_record/autosave_association.rb
+++ b/activerecord/lib/active_record/autosave_association.rb
@@ -343,8 +343,8 @@ module ActiveRecord
association.destroy
else
key = reflection.options[:primary_key] ? send(reflection.options[:primary_key]) : id
- if autosave != false && (new_record? || association.new_record? || association[reflection.primary_key_name] != key || autosave)
- association[reflection.primary_key_name] = key
+ if autosave != false && (new_record? || association.new_record? || association[reflection.foreign_key] != key || autosave)
+ association[reflection.foreign_key] = key
saved = association.save(:validate => !autosave)
raise ActiveRecord::Rollback if !saved && autosave
saved
@@ -367,7 +367,7 @@ module ActiveRecord
if association.updated?
association_id = association.send(reflection.options[:primary_key] || :id)
- self[reflection.primary_key_name] = association_id
+ self[reflection.foreign_key] = association_id
end
saved if autosave