In the current pagination docs it says that I can do this:
def list
@person_pages = Paginator.new self, Person.count, 10, @params
[''page'']
@people = Person.find :all, :order => ''last_name,
first_name'',
:conditions => @person_pages.current.to_sql
end
but @person_pages.current.to_sql returns atwo element an array, and
the :conditions parameter to Person.find expects some actual SQL.
When I try running this (either on Rails 0.13.1 or 0.14.2), I get an
error. The only way I can see around it is the somewhat messy:
def list
@person_pages = Paginator.new self, Person.count, 10, @params
[''page'']
@people = Person.find :all, :order => ''last_name,
first_name'',
:limit => @person_pages.current.to_sql[0], :offset =>
@person_pages.current.to_sql[1]
end
Am I missing something here, or is the documentation actually broken?
Is there a neater way of writing this?
(Note that I need to use the manual pagination style because in my
actual code I''m doing the find within a collection.)
Cheers,
Pete Yandell