Constructing a query from an object


#1

Hi,

Apart from checking each field in an object created from form

params, is there an easy way I can construct a query from an object? For
example, I’m doing this:

@candidate = Candidate.new(params[:candidate])

And go on to check each attribute if it’s blank and thereby constructing
a query. It’s pretty common, so I’m guessing there should be a easier
way.

Thanks,
Vamsee.