Check if an attribute was changed on the last save.
Ruby
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
README.md
README.rdoc
Rakefile

README.md

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.

BookRenter.com Logo

Copyright

Copyright (c) 2012 Mike Taylor, Bookrenter.com.