This PR adds @mutations_from_database instance variable copy to ActiveType.cast_record method. It's needed because change method from ActiveSupport uses this instance variable to carefully handle model changes.
F.e. now I have a situation when model setter is overridden by ActiveType gem. Then after I cast existing record on form I have an issue with tracking this overridden attribute. It shown like changed ({ "market_id" => [nil, 1] }) but no changes happened on it at all. I think it happens because of this desynchronization between real database and model changes and form changes.
So my point is to copy @mutations_from_database to be sure that all required trackers set or unset after model cast on form.
This PR adds
@mutations_from_database
instance variable copy toActiveType.cast_record
method. It's needed because change method from ActiveSupport uses this instance variable to carefully handle model changes.F.e. now I have a situation when model setter is overridden by ActiveType gem. Then after I cast existing record on form I have an issue with tracking this overridden attribute. It shown like changed (
{ "market_id" => [nil, 1] }
) but no changes happened on it at all. I think it happens because of this desynchronization between real database and model changes and form changes.So my point is to copy
@mutations_from_database
to be sure that all required trackers set or unset after model cast on form.