Ok it seems in a hurry to type I have made quite a few spelling mistakes, I will write it again (carefully) now, this is what you should have :
@books = Book.paginate :page => params[:page], :per_page => 10, :include => [:authors, :publishers], :order => :id and in the view for the page links you will need : <%= will_paginate @books %> Please try the one I have mentioned above, this should work properly earlier I had misspelled paginate to paginage :-S. Sorry for those typos. Thanks & Regards, Dhruva Sagar. Mike Ditka <http://www.brainyquote.com/quotes/authors/m/mike_ditka.html> - "If God had wanted man to play soccer, he wouldn't have given us arms." On Wed, Sep 2, 2009 at 8:28 AM, fireflyman <yangxiwenh...@gmail.com> wrote: > First,I want say sorry to Dhruva,because i didn't write a test,it was a > controller.When I run my > Webrick and try to use controller like > http://localhost:3000/catalog/index > it goes wrong,like this---> > > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1532:in > `method_missing_without_paginate' > C:/Ruby/lib/ruby/gems/1.8/gems/mislav-will_paginate-2.3.11/lib/will_paginate/finder.rb:170:in > `method_missing' > > > app/controllers/catalog_controller.rb:5:in `index' > > > So,what i do for thoes code > > On Wed, Sep 2, 2009 at 10:43 AM, Adam <a...@digirati.co.nz> wrote: > >> try params[:page] instead of parmas[:page]Also if you have an error post >> the trace here >> if we cant see the error ... we cant see the problem >> >> >> >> On 2/09/2009, at 2:40 PM, fireflyman wrote: >> >> Hi,Dhruva >> Thank you for your help,but I still can't pass my test.May be the code >> goes wrong . >> >> On Wed, Sep 2, 2009 at 10:23 AM, Dhruva Sagar <dhruva.sa...@gmail.com>wrote: >> >>> 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 <yangxiwenh...@gmail.com>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 . >>>> >>>> >>>> >>> >>> >>> >> >> >> -- >> Sons of Gondor, of Rohan, my brothers! >> I see in your eyes the same fear that would take the heart of me. >> A day may come when the courage of men fails when we forsake our friends >> and break all bonds of fellowship. >> But this is not this day. >> And hour of wolves and shattered shields when the age of Men comes >> crashing down. But this is not this day! >> This day we fight! By all that you hold dear on this good earth, I bid you >> stand! Men of the West! >> >> >> >> >> >> >> >> >> > > > -- > Sons of Gondor, of Rohan, my brothers! > I see in your eyes the same fear that would take the heart of me. > A day may come when the courage of men fails when we forsake our friends > and break all bonds of fellowship. > But this is not this day. > And hour of wolves and shattered shields when the age of Men comes crashing > down. But this is not this day! > This day we fight! By all that you hold dear on this good earth, I bid you > stand! Men of the West! > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---