From 5c245b91d2dbc0b300e8193310b3f950d0cf6c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 10 May 2010 12:28:38 +0300 Subject: Make sure valid? preceives the context as in ActiveModel API (ht: Carlos Antonio) --- activerecord/lib/active_record/attribute_methods/primary_key.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/attribute_methods/primary_key.rb') diff --git a/activerecord/lib/active_record/attribute_methods/primary_key.rb b/activerecord/lib/active_record/attribute_methods/primary_key.rb index 411330dda2..82d94b848a 100644 --- a/activerecord/lib/active_record/attribute_methods/primary_key.rb +++ b/activerecord/lib/active_record/attribute_methods/primary_key.rb @@ -6,7 +6,7 @@ module ActiveRecord # Returns this record's primary key value wrapped in an Array # or nil if the record is a new_record? def to_key - new_record? ? nil : [ send(self.class.primary_key) ] + new_record? ? nil : [ id ] end module ClassMethods -- cgit v1.2.3