From f8d2c77c9056e16d4f98020c94f9316835c4e099 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Thu, 30 Jul 2009 13:33:12 -0500 Subject: Redirect method missing for primary key to read_attribute --- activerecord/lib/active_record/attribute_methods/read.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord/lib/active_record/attribute_methods') diff --git a/activerecord/lib/active_record/attribute_methods/read.rb b/activerecord/lib/active_record/attribute_methods/read.rb index 7e92e0bd68..a3327dc083 100644 --- a/activerecord/lib/active_record/attribute_methods/read.rb +++ b/activerecord/lib/active_record/attribute_methods/read.rb @@ -62,6 +62,7 @@ module ActiveRecord # "2004-12-12" in a data column is cast to a date object, like Date.new(2004, 12, 12)). def read_attribute(attr_name) attr_name = attr_name.to_s + attr_name = self.class.primary_key if attr_name == 'id' if !(value = @attributes[attr_name]).nil? if column = column_for_attribute(attr_name) if unserializable_attribute?(attr_name, column) @@ -84,8 +85,7 @@ module ActiveRecord column = column_for_attribute(attr_name) self.class.send(:define_read_method, :id, attr_name, column) - # now that the method exists, call it - self.send attr_name.to_sym + id end # Returns true if the attribute is of a text column and marked for serialization. -- cgit v1.2.3