The will_paginate's paginate method creates both the instance variables and
maintains them automatically.
All you will need to do is :

@books = Book.paginage :page => parmas[:page], :per_page => 10, :include =>
[:authors, :publishers], :order => :id

You should check out railscasts.com episode 51, it demonstrates what you
wish to do quite well.

Thanks & Regards,
Dhruva Sagar.


Ted Turner <http://www.brainyquote.com/quotes/authors/t/ted_turner.html>  -
"Sports is like a war without the killing."

On Wed, Sep 2, 2009 at 7:48 AM, fireflyman <[email protected]> wrote:

>
> Hi,everybody
> I write a code like follow,the question was "paginate" has been drop
> until the rails 2.0,now we use
> "will_paginate" to replace it.But I don't know how to change my code
> to let it suitable.
>
> -----------------------------------------------------------------------------------------------------
>  def index
>    @page_title = "Book List"
>    @book_pages,@books = Book.paginate  :books,
>                                                   :per_page => 10,
>                                                   :include =>
> [:authors, :publishers],
>                                                   :order => "books.id
> desc"
>
> -------------------------------------------------------------------------------------------------
>  So,I want may be somebody can help .
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to