Testing all conditions or params

I’m stuck in a bit of a quandry here. This might be a bad
implementation
but I’m really after solving just one issue. I’ll hold off getting into
the
whole thing.
Right now I have a ajax “dynamic” search form. Dynamic meaning users
can
enter any number of choices in the 5 available fields.
In order to get the conditions correctly and allow for fields not being
used
I did the following:

unless(params[:category_id]|| “”).empty?

So each field if left unselected is being evaluated with “”
What I’m finding is that if all the fields are deselected in the form,
all
records are being returned. Not a good thing.
Not sure how to code a coditional here , and effectively , to see if all
fields are “”
And then prevent select from taking place.

Stuart


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs