Links
Slice and Dice
Categories
Slice and Dice
Allows construction of where clauses using a hash passed in as the :conditions option.
Example:
User.find :first, :conditions => {:name => 'Tom Ward'}
Task.find :all, :conditions => {:priority_more_than => 50}
Vitals
| Repository | svn://rubyforge.org//var/svn/popdog/slice_and_dice/tags/REL-0.1 |
|---|---|
| License | |
| Rating | (4 votes) |
| Owner | Tom Ward |
| Created | 23 May 2006 |
Comments
-
very nice. what's still missing in my opinion is an "in" check (when :in then ["in (?)", argument]) works nicely - that way i got a searchform with generated checkboxes to work (using <%= checkboxtag("model[fieldidin][]", a.id, false, {:alt => a.name}) %>, of course). Plus, I'm missing type checks to avoid errors that happen when - for example - comparing strings with integer fields .. or should that rather be done before doing the find?
-
Another improvement may be add a BETWEEN condition, i use (when :between then ["BETWEEN ? AND ?", argument.first, argument.last]) where argumemt is a range like 0..1000
