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:
commit
467cb908dd
1 changed files with 1 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue