As of Rails 5.2, attribute_will_change! no longer works for
non-attributes. This re-implements the required methods of Dirty
manually, similar to what was originally done by this gem.
Note: I don't think it's appropriate to override changes. It's
reasonable to expect that model.changes will never include keys that
aren't also keys in model.attributes or model.attribute_names.
I think it would be more appropriate to support the from: and to:
options in attribute_changed? instead.
Coverage increased (+0.03%) to 94.917% when pulling 886bd4985cec1efdf2131535373d4a5051233f08 on sg-min-patch into 154b5a8f37f77e80ac00a8f9591a1eb8c81f9e40 on master.
Coverage increased (+0.03%) to 94.917% when pulling c704ae1f7042195689886f505bb46f08ea212ae9 on sg-min-patch into 154b5a8f37f77e80ac00a8f9591a1eb8c81f9e40 on master.
As of Rails 5.2,
attribute_will_change!
no longer works for non-attributes. This re-implements the required methods ofDirty
manually, similar to what was originally done by this gem.Note: I don't think it's appropriate to override
changes
. It's reasonable to expect thatmodel.changes
will never include keys that aren't also keys inmodel.attributes
ormodel.attribute_names
. I think it would be more appropriate to support thefrom:
andto:
options inattribute_changed?
instead.