Searching multiple fields with conditions

were you just doing = comparisons then you could extract a hash of conditions from the params and pass that directly. for what you're doing you might look at using the ez_where plugin:


Also check out ActiveRecord::Extensions for more hash-based conditions
suck as field_like, field_contains, field_lt, field_gt, field_ne, etc.

However, hash-based conditions are added together with AND rather than
OR, so it's not much use for this particular prooblem.

I am just about to release 0.7.0 for ActiveRecord::Extensions. I am
thinking of including OR functionality. Please email me privately if
you have comments or suggestions on this.

I am planning to have:
   Book.find :all, :conditions=>{ :name_like => "Star
Wars", :or_name_like=>"Star Trek" }

generate SQL like:
   name LIKE "Star Wars"OR name LIKE "Star Trek"

It's limitation is that it will not be able to group OR'd selectors,
but it provides basic OR capabilities. thought?