will_paginate question


Is it possible to use search parameters with will_paginate?

For example, something like this:

@var = Model.paginate :per_page => 20, :page => params[:page],
                                :order => 'my_date DESC', :conditions
=>["my_date >= ? AND my_date <=?",@start,@end]

I am getting some errors with this, but will this generally work?

If you don't get a suitable answer here, you should know that there is
a will_paginate Google Group, just like this rubyonrails-talk group.
Naturally, it's called "will_paginate". :slight_smile:


I haven't used the substitution like you have, but I can do it with a
conditions hash:

@items = Item.paginate(:all,
:order => "featured DESC, #{@sort.sort}, id DESC",
:conditions => @filters,
:page => params[:page])

where @filters is a hash like {:hidden => false, :category_id => 5}.
I notice that you don't have an :all or :first at the beginning.
Maybe this matters.