Automatically create a search form for my model

Hi,

Is there a way that scaffold or some other tool can be used to create
a form that allows you to search for records in a model based on the
fields of that model? I’ve seen scaffold generates a “list” page, but
that doesn’t filter based on any criteria. (Or does it?)

My model is called “user” and the controller by which I wish to search
for records is Admin::UserController.

Thanks, - Dave

On 2/1/08, [email protected] [email protected] wrote:

Is there a way that scaffold or some other tool can be used to create
a form that allows you to search for records in a model

Records aren’t in a model, they’re in the database.

based on the
fields of that model?

Well, yeah… if you search a table then you have to use one it’s
fields to search by.

I’ve seen scaffold generates a “list” page, but
that doesn’t filter based on any criteria. (Or does it?)

No clue, I don’t use scaffolding.

My model is called “user” and the controller by which I wish to search
for records is Admin::UserController.

The controller has nothing to do with the model in this respect.

@users = User.find( :all, :conditions => [ ‘name = ?’, params[:name] ] )


Greg D.
http://destiney.com/