westonganger/paper_trail-association_tracking

doesn't seem to be doing anything?

Closed this issue · 1 comments

hello! i have a model, service, with plenty of associations on it that i'd like to track changes to.

i have a form with some collection checkboxes for to manage many-to-many relationships (for taxonomies and locations in this case). i'm expecting, when i submit the form, a new version to be saved.

sadly, no new version is saved and my version_associations table is totally blank!

any ideas?

my model looks something like this:

class Service < ApplicationRecord
  belongs_to :organisation

  has_one :contact
  has_many :service_at_locations
  has_many :locations, through: :service_at_locations

  has_many :service_taxonomies
  has_many :taxonomies, through: :service_taxonomies

  has_many :watches
  has_many :users, through: :watches

  has_many :notes

  has_paper_trail

end

i'm unsure whether i need to be sticking has_paper_trail on the associated models too, but in the taxonomies case, i've tried putting it on both the taxonomies and service_taxonomies models with no success.

Yes you need to have has_paper_trail on all associated tracked models that are to be tracked. We should document this in the readme.

Also please ensure that you have set PaperTrail.config.track_associations = true in an initializer or something