1
0
Fork 0
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:
Rafael Mendonça França 2014-09-17 16:26:49 -03:00
parent afa4780572
commit 168c0c171e

View file

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