mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use has_attribute?
This commit is contained in:
parent
afa4780572
commit
168c0c171e
1 changed files with 1 additions and 1 deletions
|
@ -404,7 +404,7 @@ module ActiveRecord
|
|||
# If the record is new or it has changed, returns true.
|
||||
def record_changed?(reflection, record, key)
|
||||
record.new_record? ||
|
||||
(record.attributes.keys.include?(reflection.foreign_key) && record[reflection.foreign_key] != key) ||
|
||||
(record.has_attribute?(reflection.foreign_key) && record[reflection.foreign_key] != key) ||
|
||||
record.attribute_changed?(reflection.foreign_key)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue