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
Due to limited volunteers, issues that do not follow this template will be
closed without comment.
Is your feature suggestion related to a problem? Please describe.
I have encountered a situation where the size of the versions table is rapidly increasing, even though there are no changes in the MySQL JSON column. Therefore, I am considering using a custom_object_changes_adapter to track and save changes in the JSON column. However, the currently supported feature requires global configuration. Since any issues with this might propagate into a service-wide failure, I would prefer to apply the setting individually for each model.
Describe the solution you'd like to build
Change it to allow setting a custom_object_changes_adaptor for each model.
Describe alternatives you've considered
Set the object_changes_adaptor for each model in ModelConfig, and check it in Base.rb
The text was updated successfully, but these errors were encountered:
The approach I took for this (which I don't think I like as much as your approach which I discovered after my own local change!) was to add a call in Base.pm's prepare_object_changes to call a function, if present, in the custom_object_changes_adaptor to set the model's class.
if PaperTrail.config.object_changes_adapter.respond_to?(:set_object_changes_record_class_name)
PaperTrail.config.object_changes_adapter.set_object_changes_record_class_name(@record.class.to_s)
end
I then have logic in my common global object_changes_adapter to do what I want based on the model. (I'm doing the same things https://github.com/hashwin/paper_trail-hashdiff does, but only for certain columns. I would be awkward to start using that gem everywhere since older data would be "normal" object changes and newer data would be hash-diffs.)
Thank you for your contribution!
Due to limited volunteers, issues that do not follow this template will be
closed without comment.
Is your feature suggestion related to a problem? Please describe.
I have encountered a situation where the size of the versions table is rapidly increasing, even though there are no changes in the MySQL JSON column. Therefore, I am considering using a custom_object_changes_adapter to track and save changes in the JSON column. However, the currently supported feature requires global configuration. Since any issues with this might propagate into a service-wide failure, I would prefer to apply the setting individually for each model.
Describe the solution you'd like to build
Change it to allow setting a custom_object_changes_adaptor for each model.
Describe alternatives you've considered
Set the object_changes_adaptor for each model in ModelConfig, and check it in Base.rb
The text was updated successfully, but these errors were encountered: