Hi, I am trying to implement a few queries now. What are good ways to do
Right now, I have a list page that does sorting and can carry out a
generic pagination request.
@user_result_pages, @user_results = paginate(:user_results,
:per_page => 20,
:conditions => @condition,
:order_by => @sort_order)
I create @sort_order earlier in the list function. The problem I am
having is with ‘@condition’ I’m not sure what’s the best way to create
this. There are a number of options that my user may select:
- date > …
- range of dates
- specific dates
- name is LIKE …
and so on…
I’m therefore having trouble conceptualizing how to create this
condition string. All the examples I have seen so far talk about it as
:conditions => [?created_on > ??, time] and so on. I can’t find an
example that helps me formulate this string earlier.
Another example I saw uses ‘sanitize’ which seems to be available in the
model but not the controller, so I can’t seem to use that either.
Help would be greatly appreciated