Slice and Dice plugin

Plugin details

Allows simple conditions to be used in active record finders and calculations without having to write sql

Repositorysvn://rubyforge.org//var/svn/popdog/slice_and_dice/tags/REL-0.1 Author Tom Ward Tags condition, ActiveRecord LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install svn://rubyforge.org//var/svn/popdog/slice_and_dice/tags/REL-0.1

Alters ActiveRecord's condition handling to allow conditions specified as a hash of predicates, e.g:

  User.find :first, :conditions => {:name => 'Tom'}
  Task.find :all, :conditions => {:owner_id => 12}


In addition to these simple equality conditions, other more complex conditions can be specified without recourse to SQL:

  User.find :first, :conditions => {:post_count_more_than => 20}
  Task.find :all, :conditions => {:description_contains => 'london'}


As well as finder methods, this condition syntax also works with scoping, calculations and other areas where normal active record conditions can be used

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, 10 months ago