enumerize: enumerize make paper_trail not working properly

enumerize :status, in: {editing: 0, finished: 1, published: 2}, default: :editing, scope: true, predicates: true

add this line will make paper_trail not track status changes, I don’t know which gem cause this issue, so I just report both, hope this can be fixed soon

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 19 (6 by maintainers)

Most upvoted comments

I am currently still facing this issue with enumerize 1.1.0 and the paper_trail YAML serializer

class Some < ActiveRecord::Base
  extend Enumerize
  has_paper_trail

  serialize :things, Array
  enumerize :things, in: [:a_thing, :b_thing, :c_thing], default: :a_thing, multiple: true
end

It actually throws an exception Attribute was supposed to be a Array, but was a Enumerize::Set. -- #<Enumerize::Set {a_thing}>

@luizcarvalho I checked the test application and reproduced the same issue even without enumerize in Gemfile. So this is clearly not an enumerize issue.

However, I also checked paper_trail README and noticed the following:

he best way to diff adjacent versions is to get PaperTrail to do it for you. If you add an object_changes text column to your versions table, either at installation time with the rails generate paper_trail:install --with-changes option or manually, PaperTrail will store the changes diff (excluding any attributes PaperTrail is ignoring) in each update version. You can use the version.changeset method to retrieve it.

I think that changeset method will work only if an object_changes column is present. Hope this will help.