Undo with Paper Trail in Rails 2.3.8
I was recently impressed by Ryan Bates recent Railscast on Undo with Paper Trail, but faced a few difficulties trying to port it into a Rails 2.3.8 project.
Rails 3+ has access to the view_context in the controller. It took me a while to find this because I’ve never needed it, but Rails 2.3.8 has similar access to the link_to helper via @template.
I also found that the undo action taken immediately after a create caused an Activerecord::RecordNotFound error, caused by a redirect_to the show action of the record that was just destroyed.
After fixing these issues I decided to fork Ryan’s source and provide a Rails 2.3.8 version. You can find this at https://github.com/MeetDom/railscasts-episodes/tree/rails238/episode-255. I hope someone else finds this useful.



