Is it possible to filter by conditions before paginating?
- by Brian Roisentul
I'm using ruby on rails 2.3.8 and will_paginate plugin.
I've just noticed that if I write something like this:
Announcement.paginate :page => params[:page], :per_page => 10, :conditions => some_condition
it will work.
But, if I write something like this:
announcements = Announcement.all :conditions => some_condition
@ann = announcements.paginate :page => params[:page], :per_page => 10
it won't recognize conditions.
Maybe you're wondering "why would he want to do that?", well, it's a long story and I really need to first filter the conditions and then paginate the results.