Filthy
Rails gem to check if an attribute was changed on the last save. Useful in after_save callbacks.
Install
gem install filthy
Usage
class Movie < ActiveRecord::Base
include Filthy
filthy_attributes :title, :director
end
@movie = Movie.find(1)
@movie.title = "28 days later"
@movie.title_filthy?
=> false
@movie.save
=> true
@movie.title_filthy?
=> true
@movie.save
=> true
@movie.title_filthy?
=> false
Credits
Filthy is maintained by Mike Taylor and is funded by BookRenter.com. Many of the ideas that have inspired Filthy come from practical usage by the Bookrenter software development team and conversations with Bookrenter developers Andrew Wheeler, Michael Pearce, Philippe Huibonhoa, and Ben Somers.
Copyright
Copyright (c) 2012 Mike Taylor, Bookrenter.com.