Ecto paper trail

188 views
Skip to first unread message

lau...@kabisa.nl

unread,
Jul 20, 2016, 6:14:11 AM7/20/16
to elixir-lang-talk
Hello everyone,

Rails has this great gem that allows you to track changes to your model automatically, called paper trail (https://github.com/airblade/paper_trail). Is there something similar available for Elixir? Google does not turn anything up but if someone knows of anything, I would love to hear!

Kind regards,


Laurens

Steve Pallen

unread,
Jul 20, 2016, 9:41:01 AM7/20/16
to elixir-lang-talk
I started working on a package. It needs a little more work before I can release it. What specific features are you looking for? 

Steve


Steve Pallen

unread,
Jul 21, 2016, 11:39:52 PM7/21/16
to elixir-l...@googlegroups.com
I just published a package on hex. https://hex.pm/packages/whatwasit 

Feedback welcome. 

Steve

José Valim

unread,
Jul 22, 2016, 8:06:50 AM7/22/16
to elixir-l...@googlegroups.com
Awesome. Btw, there is likely no need to use Whatwasit.Schema. You can probably get away with import and passing the name as option directly to the functions being invoked.



José Valim
Skype: jv.ptec
Founder and Director of R&D

--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/BFAF58AD-01DC-4644-8785-E1BDD26238A6%40gmail.com.

For more options, visit https://groups.google.com/d/optout.

Kyle Hanson

unread,
Jul 22, 2016, 12:36:19 PM7/22/16
to elixir-l...@googlegroups.com
Steve, 

This is an exciting project!

I implemented something similar to this and papertrail internally for a django project at the company I work for. One of the biggest benefits was being able to track request meta information along with what was changed. In terms of integration with phoenix, I am wondering if instead of passing in the user, it could be more interesting to pass in the connection object itself so you can also tell what path/IP modified it - but that would specialize the library towards phoenix. Maybe just allow arbitrary metadata.

Would it also make sense instead of having a key to the User, the tracking information linked to the version of the user at that time (this would give you the IP from the coherence library at the time of update) to avoid any relationships outside of the Version table (if you wanted to keep stuff in a separate DB)?

--
Kyle

Steve Pallen

unread,
Jul 22, 2016, 1:00:04 PM7/22/16
to elixir-l...@googlegroups.com
Kyle,

Thanks for the excellent feedback. I’m in the process of generating the Version model from a template in the installer. This way, it will be in your project for any customization you may want to do. Once I have the finished, I’ll look at the Schema file and see how I can make it generic so I have the programmer control on what is saved in the Version record. This should give the flexibility your suggesting. I’m a little sensitive to the size of the version record, so I think the default will be to store the user id only, with the ability to customize.

Steve

Steve Pallen

unread,
Jul 22, 2016, 6:07:01 PM7/22/16
to elixir-l...@googlegroups.com
José, Whatwasit.Schema is gone on v0.2.0. Thanks for the suggestion! 

Steve

You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-talk/xxVveLXvn-I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-lang-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/CAGnRm4KOdoHgn5tAKZEn2vi2NvMxD8NYiM_Q_GjE1BHTNsgZpw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages