rails_admin_history_rollback
rails_admin_history_rollback copied to clipboard
paper_trail restore relations
Thanks for this great module!
The newest paper_trail makes it possible to restore relations (has_one and has_many), but you need to supply the options ":has_many => true, :has_one => true" to the method "reify" to make this possible:
https://github.com/airblade/paper_trail#associations
This to ensure backward compatibility, and not to confuse/enrage simple users.
Would it be interesting to add an extra button to restore also these associations? For example "rollback (including assocations)"
Hi @nicolasfranck thanks for your feedback, really appreciated. Your idea sounds great, do you have a set up you'd be able to test this on? It would be awesome if you could help contribute this new feature to the module. Fancy submitting a pull request?
Cheers,
Rikki
I'm working on it. But it's more complicating than you think.
When you only remove/add a relation, and change nothing to the parent record, there is no new version of this parent record. So no new version appears in history index, you can use as a reference. It works if you update both parent record and relations.
I'll notify you
Hey @nicolasfranck, it's tricky indeed. When I get a spare moment, I'll take a look into it too. I'm sure between us we can figure it out. I'll create a branch for it soon so we can test it all works.
Rikki