Is there any way tod o this? I have a hash with keys that symbols
matching valid attributes of the entity, and values that are the values
I want to match. Surely there is some ActiveRecord method to find
objects based on this, no?
I've been using code like this more often in RESTful controllers. By
accumulating the find options for the #index action I can use it to
serve several purposes. The most obvious example would be for filter
+paging:
The important thing to be aware of is that the hash to be passed to
ARec#find comes *after* a required first parameter (symbols :first
or :all, an id, an array of ids).
@Jonathan -- sorry, I didn't read yours closely enough. The thing
that you're missing is that the parameters for the sql query are added
to the hash keyed by :conditions. Hopefully the rest of my response
clears that up.