You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Work on 1.1.1 with Rails 4.2 (ar_typed_store appears and attr_in_ar_typed_store too) :
{"ar_typed_store"=>[{"attr_in_ar_typed_store"...},{"attr_in_ar_typed_store"...}], "attr_in_ar_typed_store"=>[nil, 'test'], updated_at"=>[Tue, 27 Jun 2017 09:53:32 UTC +00:00, Tue, 27 Jun 2017 09:56:28 UTC +00:00]}
Don't work on 1.1.1 with Rails 5.1.1 (ar_typed_store appears but not attr_in_ar_typed_store)
# {"ar_typed_store"=>[{"attr_in_ar_typed_store"...},{"attr_in_ar_typed_store"...}], updated_at"=>[Tue, 27 Jun 2017 09:53:32 UTC +00:00, Tue, 27 Jun 2017 09:56:28 UTC +00:00]}
EDIT : works in rails 4.2 with Activerecord-Typedstore 1.1.1
The text was updated successfully, but these errors were encountered:
Thanks for opening the issue. I dug on this, and it's not going to be simple to put back the original behaviour.
The behaviour changed because of rails/rails@136fc65 which was introduce in rails 5.0 Model#previous_changes was previously defined in ActiveModel and was just returning the @previously_changed hash. This gem injects store attributes inside that hash.
On rails >= 5.0, previous_changes is delegated to AttributeMutationTracker#changes, the implementation returns only attributes that AR is aware of.
Vanilla rails store method never behave that way, and I was asking myself if this could be something we could patch upstream, as it's pretty useful.
I had looked at the typed_store and rails code for a few days. But I don't think it's possible without monkey patch rails. And I'm not sure it's a good idea... :(
ActiveModel::Dirty#previous_changes (http://api.rubyonrails.org/classes/ActiveModel/Dirty.html#method-i-previous_changes) don't return attributes out of ar_typed_store field.
Model :
To reproduce that issue :
Work on 1.1.1 with Rails 4.2 (ar_typed_store appears and attr_in_ar_typed_store too) :
{"ar_typed_store"=>[{"attr_in_ar_typed_store"...},{"attr_in_ar_typed_store"...}], "attr_in_ar_typed_store"=>[nil, 'test'], updated_at"=>[Tue, 27 Jun 2017 09:53:32 UTC +00:00, Tue, 27 Jun 2017 09:56:28 UTC +00:00]}
Don't work on 1.1.1 with Rails 5.1.1 (ar_typed_store appears but not attr_in_ar_typed_store)
# {"ar_typed_store"=>[{"attr_in_ar_typed_store"...},{"attr_in_ar_typed_store"...}], updated_at"=>[Tue, 27 Jun 2017 09:53:32 UTC +00:00, Tue, 27 Jun 2017 09:56:28 UTC +00:00]}
EDIT : works in rails 4.2 with Activerecord-Typedstore 1.1.1
The text was updated successfully, but these errors were encountered: