diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-08 23:39:28 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-08 23:39:28 +0000 |
commit | cdc3c246c62e65f32724d20ca7d6a29f1d08b59a (patch) | |
tree | 60ce69ea4d67608e3a3a14aeb702cac5b4ec3d1e /activerecord | |
parent | 9929cb4ec23e1f89177f174841d3f92ec212b4e2 (diff) | |
download | rails-cdc3c246c62e65f32724d20ca7d6a29f1d08b59a.tar.gz rails-cdc3c246c62e65f32724d20ca7d6a29f1d08b59a.tar.bz2 rails-cdc3c246c62e65f32724d20ca7d6a29f1d08b59a.zip |
belongs_to infers the foreign key from the association name instead of from the class name. Fulfills the 1.2.4 deprecation.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7812 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index fd5bf2f174..3188f0bfc2 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* belongs_to infers the foreign key from the association name instead of from the class name. [Jeremy Kemper] + * PostgreSQL: support multiline default values. #7533 [Carl Lerche, aguynamedryan, Rein Henrichs, Tarmo Tänav] * MySQL: fix change_column on not-null columns that don't accept dfeault values of ''. #6663 [Jonathan Viney, Tarmo Tänav] diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 6a2887e528..2a0c4db82d 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1617,7 +1617,7 @@ module ActiveRecord klass.quote_value(reflection.options[:source_type]) ] else - second_key = source_reflection.options[:foreign_key] || klass.to_s.foreign_key + second_key = source_reflection.primary_key_name end end |