aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2014-02-21 12:35:56 -0300
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2014-02-21 12:35:56 -0300
commit467cb908dd5f40cbfefe41b93e219682a3ced535 (patch)
tree59edc49ef147a0163913a1eed202ad3b537e8245 /activerecord/lib/active_record
parentb1867c85fa934caad1cd7410e1bd9bc0463a2f42 (diff)
parentdbf9ec071497cd3935c8e5cd59df57f3fd9bbb17 (diff)
downloadrails-467cb908dd5f40cbfefe41b93e219682a3ced535.tar.gz
rails-467cb908dd5f40cbfefe41b93e219682a3ced535.tar.bz2
rails-467cb908dd5f40cbfefe41b93e219682a3ced535.zip
Merge pull request #14140 from WojtekKruszewski/optimize_foreign_key_for
Prevent foreign_key_for? from evaluating all attributes
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations/association.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb
index 4e46256862..9ad2d2fb12 100644
--- a/activerecord/lib/active_record/associations/association.rb
+++ b/activerecord/lib/active_record/associations/association.rb
@@ -232,7 +232,7 @@ module ActiveRecord
# Returns true if record contains the foreign_key
def foreign_key_for?(record)
- record.attributes.has_key? reflection.foreign_key
+ record.has_attribute?(reflection.foreign_key)
end
# This should be implemented to return the values of the relevant key(s) on the owner,