1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Set primary key with id= only if primary key exists

This commit is contained in:
Guillermo Iguaran 2012-09-14 15:29:55 -05:00
parent 2d7ae1b08e
commit 3919fcd61e

View file

@ -18,7 +18,7 @@ module ActiveRecord
# Sets the primary key value # Sets the primary key value
def id=(value) def id=(value)
write_attribute(self.class.primary_key, value) write_attribute(self.class.primary_key, value) if self.class.primary_key
end end
# Queries the primary key value # Queries the primary key value