Skip to content
Browse files

Set primary key with id= only if primary key exists

  • Loading branch information...
1 parent 2d7ae1b commit 3919fcd61ef999aab9397332ce3017870b184766 @guilleiguaran guilleiguaran committed Sep 14, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/attribute_methods/primary_key.rb
View
2 activerecord/lib/active_record/attribute_methods/primary_key.rb
@@ -18,7 +18,7 @@ def id
# 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

0 comments on commit 3919fcd

Please sign in to comment.
Something went wrong with that request. Please try again.