0

I have been trying the public_activity gem through the RailsCast tutorial and I just noticed that any data described in the activities can't be identified again once a record is destroyed, and I think this is a turn off on user experience. For example, I can only do this type of statements like

User has deleted his post.

instead of,

User has deleted his post entitled "Some random post".

I read the comments section of the public_activity tutorial from RailsCast and I visited a link that lead me to the Redcrumbs gem from there. After going through the documentation, I noticed that it only tracks changes on the records.

So, are there any other gems that can do what I need? Or should I continue to use the public_activity gem instead and just delete all the activity logs related to the destroyed record?

oLraX
  • 217
  • 4
  • 14

2 Answers2

0

There is a good solution – https://github.com/airblade/paper_trail This gem stores information about any model you need in any particular time. Good news that gem also stores information (trail) after object has been destroyed.

Pavel Tkackenko
  • 963
  • 7
  • 20
  • I tried it recently and it's a good start. However, I think it's more convenient to add a `description` attribute to versions so that I won't repeat myself from using `reify` or getting the needed details from the records. Manually putting a description to the respective version of a record doesn't seem to work. Does paper_trail have a feature for adding a description for each version? – oLraX Nov 01 '14 at 15:23
  • Parer_trail creates migration, so you can modify the paper_trail table as you wish. – Pavel Tkackenko Nov 02 '14 at 06:58
  • I tried to add a description attribute for the versions table, and I implemented it using model callbacks. However, it doesn't seem to work. So I tried to manually add a description for a certain record from the versions table using the rails console. Unfortunately, it also doesn't work because it doesn't save when I use the `update` command. – oLraX Nov 02 '14 at 13:00
0

Creator of Redcrumbs here.

Thanks for flagging this up.

In our own apps we tracked the deleted_at or other relevant attribute because we were soft-deleting those objects - so we never actually encountered this problem.

I've opened an issue to deal with this and hope to have it in the next version of the gem. If you have any suggestions feel free to comment on the issue.

Thanks.

John H
  • 2,488
  • 1
  • 21
  • 35