acts_as_comparable 1.2 released
on June 30, 2007 @ 08:55 PM
acts_as_comparable 1.2 has been released with a minor update. This includes a fix to handling additional options passed into the declarative acts_as_comparable call.
For example with acts_as_comparable 1.1:
1 2 3 4 5 6 7 8 9 |
# this works class Model < ActiveRecord::Base acts_as_comparable end # the options passed in are ignored. class Model < ActiveRecord::Base acts_as_comparable :except => [:id, :name] end |
Now in 1.2 this is fixed so you can pass the following options make calls like:
1 2 3 |
acts_as_comparable acts_as_comparable :only=>[:first_name, :last_name] acts_as_comparable :except => [:id, :name] |
Installing as a RubyGem
gem install -r acts_as_comparable |
Installing as a Plugin
Installing from a version
1 2 |
script/plugin install \ http://rails.lotswholetime.com/svn/acts_as_comparable/tags/acts_as_comparable-1.2 |
Introducing acts_as_comparable
on April 21, 2007 @ 01:52 AM
Mark VanHolstyn and Zach Dennis kick out another ActiveRecord plugin. The previous plugin ActiveRecord::Extensions now has a smaller, helpful cousin. This plugin has been in use for over a year but not released until tonight!
“acts_as_comparable” is plugin for ActiveRecord which allows you to easily compare and determine the differences between two ActiveRecord models.
1 2 3 4 5 6 7 8 9 10 11 |
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"]} |
The usage in the above example shows the only option, but this also works with no options, the except option and also the attrs_map option. See it’s ruby doc for more information.
Installing as a RubyGem
gem install -r acts_as_comparable |
Installing as a Plugin
Installing from a version
script/plugin install http://rails.lotswholetime.com/svn/acts_as_comparable/tags/acts_as_comparable-1.1 |


