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

Merge pull request #14140 from WojtekKruszewski/optimize_foreign_key_for

Prevent foreign_key_for? from evaluating all attributes
This commit is contained in:
Carlos Antonio da Silva 2014-02-21 12:35:56 -03:00
commit 467cb908dd

View file

@ -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,