#id is an alias for whatever the primary key is

This commit is contained in:
Jon Leighton
2011-11-30 14:16:30 +00:00
parent 40840aa9ea
commit 4c33d517d9

View File

@@ -5,7 +5,7 @@ module ActiveRecord
# Returns this record's primary key value wrapped in an Array if one is available
def to_key
key = send(self.class.primary_key)
key = self.id
[key] if key
end