Search code examples
ruby-on-railsactiverecordruby-on-rails-plugins

"Was dirty" plugin for ActiveRecord?


I'm working on some code that uses a lot of after_save callbacks, and I remember seeing a plugin that allows the model.changes array to persist after a call to save.

It would be a great help if I could just write if body_did_change? in my after_save calls, instead of having to hack together something with a before_save filter just to set a flag.

I have written something like this myself before, but I'd prefer to use something supported and I swear I've seen this plugin before.


Solution

  • I believe it is built-in now - a recent feature. I have been using it in my project.. See http://ryandaigle.com/articles/2008/3/31/what-s-new-in-edge-rails-dirty-objects