paper_trail is working great for us. But when we login to Heroku's console with heroku run console
and then we make a change, the originator of the change is not set :(. So paper_trail has a mechanism for this:
In a console session you can manually set who is responsible like this:
>> PaperTrail.whodunnit = 'Andy Stewart'
>> widget.update_attributes :name => 'Wibble'
>> widget.versions.last.whodunnit # Andy Stewart
You can avoid having to do this manually by setting your initializer to pick up the username of the current user from the OS, like this:
<bunch of code>
My question is how we can automate this with Heroku? Is there maybe something like this I can do?
heroku run console -e "PaperTrail.whodunnit = '123:console'"
Then each of us could simply create a console.sh
file with the above using our individual user ids. Or is there another mechanism to automate this?