Closed fabioxgn closed 2 years ago
Hi! Could you please provide the example of your models, or (even better) a failing spec? The error above is related to the parent tracking feature.
Why is this loaded to models that does not have json models defined?
Because this is how ActiveRecord plugins usually work.
Hi @DmitryTsepelev I think I know why this is happening. It is falling in one specific model, and this model has an attribute called method
, and the code is breaking here: https://github.com/DmitryTsepelev/store_model/blob/26b3ac0cc748e3d6378ef9e1e97b729330faa49d/lib/store_model/ext/parent_assignment.rb#L12
So it is calling the method
attribute of the model instead of the method
ruby function. I'll try to write a failing spec for this, but probably changing this to the following will fix the issue:
attribute.each do { |a| assign_parent_to_singular_store_model(a) }
Closing the issue for now, explanation is here
I added the gem to our project and created 2 models to use jsonb columns and they work as expected, but when running our test suite I'm getting this error in a random model that has nothing to do with the models that I added the json column to:
Looks like you are patching Active Record here? https://github.com/DmitryTsepelev/store_model/blob/master/lib/store_model/railtie.rb
Why is this loaded to models that does not have json models defined?