byroot / activerecord-typedstore

ActiveRecord::Store but with type definition
MIT License
437 stars 57 forks source link

Support Rails 5.2+ #62

Closed sgrif closed 6 years ago

sgrif commented 6 years ago

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.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.03%) to 94.917% when pulling 886bd4985cec1efdf2131535373d4a5051233f08 on sg-min-patch into 154b5a8f37f77e80ac00a8f9591a1eb8c81f9e40 on master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.03%) to 94.917% when pulling c704ae1f7042195689886f505bb46f08ea212ae9 on sg-min-patch into 154b5a8f37f77e80ac00a8f9591a1eb8c81f9e40 on master.