Rails 4 compatibility

Lifted many Rails 4 compatibility fixes from the paper_trail project. Seems to be working in my Rails 4 app so far.

Not sure if/how this affects Rails 3, so let me know if this busts anything in your project.