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
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).
Hello, @westonganger .
I faced the problem below when I use PT-AT gem with paper_trail.
version info
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.
paper_trail-association_tracking/lib/paper_trail_association_tracking/record_trail.rb
Line 177 in c8e8b2c
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)
.I created PR but it failed(I don't know why ...)
The text was updated successfully, but these errors were encountered: