Skip to content

previous_changes don't work with 1.1.1 and Rails 5.1 #55

Description

@rivsc

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 :

class Product < ActiveRecord::Base
  typed_store :ar_typed_store do |s|
    s.string :attr_in_ar_typed_store
  end
end

To reproduce that issue :

a = Product.find(x)
a.attr_in_ar_typed_store = 'test'
a.save #=> true
puts a.previous_changes

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions