Forum: Ruby on Rails Pagination help/how to

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2006-02-16 07:51
(Received via mailing list)
Hello,

  I want to know how can I paginate a set of records. It seems
there is no direct way of doing this, and I am not able to understand
the
documentation of paginate, so any pointers on how to do this will be
much
appreciated.

To be specific what I want is that the records returned by user.recipes,
the
recipes of the particular user be paginated.

My attempt to do this failed because paginate expects a constant and not
set
of records.

@recipe_pages, @recipes = paginate( user.recipes, :per_page => 10)

Thanks for your help.

--
Surendra S.
http://ssinghi.kreeti.com, http://www.kreeti.com
Read the latest news at: http://news.kreeti.com
Craig W. (Guest)
on 2006-02-16 09:25
(Received via mailing list)
On Wed, 2006-02-15 at 23:53 +0530, removed_email_address@domain.invalid wrote:
> My attempt to do this failed because paginate expects a constant and not set
> of records.
>
> @recipe_pages, @recipes = paginate( user.recipes, :per_page => 10)
>
> Thanks for your help.
----
something like this...

@recipe_pages, @recipes = paginate(
  :recipes,
  :order =>  'user',
  :per_page => 10)

but I wonder if user is a field within your recipes table. If so, that
should work.

Craig
This topic is locked and can not be replied to.