When updating a Product instance, updating failed with following error messages.
Rails couldn't find a valid model for ProductMaster association.
Please provide the :class_name option on the association declaration.
If :class_name is already provided, make sure it's an ActiveRecord::Base subclass.
I saw record_update method in lib/paper_trail_association_tracking/record_trail.rb and debug the method.
Finally,I found the error is occurring here.
assoc cannot return class name because klass is not defined in ActiveHash, I guess.
solution suggesting
In my local environment, using constantize works for updating a model which have associations defined by both belongs_to_active_hash and belongs_to(active_record).
problem
My code has
Product
andProductMaster
classes.When updating a
Product
instance, updating failed with following error messages.I saw
record_update
method inlib/paper_trail_association_tracking/record_trail.rb
and debug the method. Finally,I found the error is occurring here.https://github.com/westonganger/paper_trail-association_tracking/blob/c8e8b2cc06f25d8563338ee08a95e6d9e2e335bf/lib/paper_trail_association_tracking/record_trail.rb#L177
assoc
cannot return class name becauseklass
is not defined in ActiveHash, I guess.solution suggesting
In my local environment, using
constantize
works for updating a model which have associations defined by bothbelongs_to_active_hash
andbelongs_to(active_record)
.