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:
parent
2d7ae1b08e
commit
3919fcd61e
1 changed files with 1 additions and 1 deletions
|
@ -18,7 +18,7 @@ module ActiveRecord
|
|||
|
||||
# Sets the primary key value
|
||||
def id=(value)
|
||||
write_attribute(self.class.primary_key, value)
|
||||
write_attribute(self.class.primary_key, value) if self.class.primary_key
|
||||
end
|
||||
|
||||
# Queries the primary key value
|
||||
|
|
Loading…
Reference in a new issue