diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-04-19 17:14:08 -0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-04-19 17:14:08 -0400 |
commit | b584cc68fc28492147ed3ed127ad8a7441ca8161 (patch) | |
tree | 8b61da1bb21e7ad93fc1719dcc27d9354d20b80c /activerecord/lib/active_record | |
parent | 9721b45b40c045a132b7177f0e86b0f5d567a2df (diff) | |
download | rails-b584cc68fc28492147ed3ed127ad8a7441ca8161.tar.gz rails-b584cc68fc28492147ed3ed127ad8a7441ca8161.tar.bz2 rails-b584cc68fc28492147ed3ed127ad8a7441ca8161.zip |
Use _read_attribute(primary_key) instead of id
This will avoid the indirection of having calling id since we already
know which is the primary key column.
Also this will make explicit the behavior since it is not clear that id
gets the right primary key value and not just the value of the "id"
column.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index 9bb45aa3b7..ae1c326d95 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -479,7 +479,7 @@ module ActiveRecord clear_attribute_changes(changes.keys) primary_key = self.class.primary_key - scope = self.class.unscoped.where(primary_key => id) + scope = self.class.unscoped.where(primary_key => _read_attribute(primary_key)) if locking_enabled? locking_column = self.class.locking_column |