Very simple Rails plugin that adds the method ‘previous_changes’ to ActiveRecord objects that can be called after saving a model object to fetch what the method ‘changes’ would have returned just before the save occurred (a hash from attribute name to a pair of values - the old attribute value and the new attribute value).

Installation


$ gem sources -a gems.github.com (you only have to do this once) $ sudo gem install tomriley-previous_changes

Then add a dependency to your rails environment.rb:

config.gem ‘tomriley-previous_changes’, :lib => ‘previous_changes’, :version => ‘0.0.1’