aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2005-10-13 20:44:39 +0000
committerMarcel Molina <marcel@vernix.org>2005-10-13 20:44:39 +0000
commitebf618b7fc39d66852f666c12b79fd6e71da0e3a (patch)
tree6b61e6e86ee913a3d2b5f4fe7a866bde2d0e071b /activerecord/lib/active_record/base.rb
parentf0448f5631288e3b73f9c95ebc1870dd54967a87 (diff)
downloadrails-ebf618b7fc39d66852f666c12b79fd6e71da0e3a.tar.gz
rails-ebf618b7fc39d66852f666c12b79fd6e71da0e3a.tar.bz2
rails-ebf618b7fc39d66852f666c12b79fd6e71da0e3a.zip
Delegate access to a customized primary key to the conventional id method. Closes #2444.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2569 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-xactiverecord/lib/active_record/base.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 3f0201a202..8af2c33ce5 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1331,6 +1331,8 @@ module ActiveRecord #:nodoc:
if @attributes.include?(method_name)
define_read_methods if self.class.read_methods.empty? && self.class.generate_read_methods
read_attribute(method_name)
+ elsif self.class.primary_key.to_s == method_name
+ id
elsif md = /(=|\?|_before_type_cast)$/.match(method_name)
attribute_name, method_type = md.pre_match, md.to_s
if @attributes.include?(attribute_name)