Plugins - acts_as_comparable
Add to favoritesacts_as_comparable is an easy way to compare ActiveRecord models based on their attributes.
class Person
acts_as_comparable :only=>[:first_name, :last_name]
end
joe = Person.new :first_name=>"Joe", :last_name=>"Smith"
joseph = Person.new :first_name => "Joseph", :last_name=>"Smith"
joe.same?( joseph ) # => false
joe.different?( joseph ) # => true
joe.differences( joseph ) # => {:first_name=>["Joe", "Joseph"]}
http://www.continuousthinking.com/2007/4/21/introducing-acts_as_comparable
http://rails.lotswholetime.com/svn/acts_as_comparable
Rails' (MIT)
Model
Tags
Comments
Add a comment- Peter Boling 8 Mar 2008
- I am unable to get to the repository for the plugin install... svn: PROPFIND of '/svn/acts_as_comparable/tags/acts_as_comparable-1.2': Could not resolve hostname `rails.lotswholetime.com': Host not found (http://rails.lotswholetime.com)
