aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-01-03 19:54:38 +0000
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-03 16:24:32 -0800
commit0619dc2319cf839977ea9670a52d9280a1af3595 (patch)
tree74529dc1679b24520bc61ea0e453b724b94b94cd /activerecord/lib/active_record
parenta9bed985cfd7d1ae93f475542bb878aa939e1c1e (diff)
downloadrails-0619dc2319cf839977ea9670a52d9280a1af3595.tar.gz
rails-0619dc2319cf839977ea9670a52d9280a1af3595.tar.bz2
rails-0619dc2319cf839977ea9670a52d9280a1af3595.zip
Implement deprecated version of AssociationReflection#primary_key_name, which has been renamed to #foreign_key. Also bumping the deprecation_horizon in Active Support to 3.1.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/reflection.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index bc5824104e..937efe395f 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -1,4 +1,5 @@
require 'active_support/core_ext/class/attribute'
+require 'active_support/core_ext/module/deprecation'
module ActiveRecord
# = Active Record Reflection
@@ -200,6 +201,11 @@ module ActiveRecord
@foreign_key ||= options[:foreign_key] || derive_foreign_key
end
+ def primary_key_name
+ foreign_key
+ end
+ deprecate :primary_key_name => :foreign_key
+
def foreign_type
@foreign_type ||= options[:foreign_type] || "#{name}_type"
end