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 .
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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 - "Sports is like a war without the killing." > > On Wed, Sep 2, 2009 at 7:48 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > 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! > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
One thing that I forgot is that you will need to add the following to your view to create the page links <%= will_paginate @books %> Thanks & Regards, Dhruva Sagar. Stephen Leacock<http://www.brainyquote.com/quotes/authors/s/stephen_leacock.html> - "I detest life-insurance agents: they always argue that I shall some day die, which is not so." On Wed, Sep 2, 2009 at 8:10 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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! > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Oh, thanks for pointing that out Adam, There is indeed a spellings mistake, it must be params[:page] Thanks & Regards, Dhruva Sagar. Marie von Ebner-Eschenbach<http://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac.html> - "Even a stopped clock is right twice a day." On Wed, Sep 2, 2009 at 8:13 AM, Adam <adam-K36Kqf6HJK7JKwlM9GxbOw@public.gmane.org> 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.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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! > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 <adam-K36Kqf6HJK7JKwlM9GxbOw@public.gmane.org> 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.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 <adam-K36Kqf6HJK7JKwlM9GxbOw@public.gmane.org> 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.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
It still goes wrong,> 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'' > > > > > <http://www.brainyquote.com/quotes/authors/s/stephen_leacock.html>--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Now,we got a new problem,like this-->> Association named ''publishers'' was not found; perhaps you misspelled it? > >On Wed, Sep 2, 2009 at 11:15 AM, Dhruva Sagar <dhruva.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> 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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <adam-K36Kqf6HJK7JKwlM9GxbOw@public.gmane.org> 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.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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! >> >> >> >> >> > > > >-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
When i change ''publishers'' to ''publisher'',now we got like follow private method `scan'' called for :id:Symbol On Wed, Sep 2, 2009 at 11:27 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Now,we got a new problem,like this--> > >> Association named ''publishers'' was not found; perhaps you misspelled it? >> >> > > On Wed, Sep 2, 2009 at 11:15 AM, Dhruva Sagar <dhruva.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> 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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <adam-K36Kqf6HJK7JKwlM9GxbOw@public.gmane.org> 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.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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! >>> >>> >>> >>> >>> >> >> >> >> > > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
In the statement, it should be :order => ''id'' and not :order => :id Thanks & Regards, Dhruva Sagar. Marie von Ebner-Eschenbach<http://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac.html> - "Even a stopped clock is right twice a day." On Wed, Sep 2, 2009 at 8:59 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> When i change ''publishers'' to ''publisher'',now we got like follow > > private method `scan'' called for :id:Symbol > > > > On Wed, Sep 2, 2009 at 11:27 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> Now,we got a new problem,like this--> >> >>> Association named ''publishers'' was not found; perhaps you misspelled it? >>> >>> >> >> On Wed, Sep 2, 2009 at 11:15 AM, Dhruva Sagar <dhruva.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >> >>> 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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <adam-K36Kqf6HJK7JKwlM9GxbOw@public.gmane.org> 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.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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! >>>> >>>> >>>> >>>> >>>> >>> >>> >>> >> >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
We had got another failure-->> private method `scan'' called for 48756360:Fixnum > >On Wed, Sep 2, 2009 at 11:42 AM, Dhruva Sagar <dhruva.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> In the statement, it should be :order => ''id'' and not :order => :id > > Thanks & Regards, > Dhruva Sagar. > > > Marie von Ebner-Eschenbach<http://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac.html> - "Even a stopped clock is right twice a day." > > On Wed, Sep 2, 2009 at 8:59 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> When i change ''publishers'' to ''publisher'',now we got like follow >> >> private method `scan'' called for :id:Symbol >> >> >> >> On Wed, Sep 2, 2009 at 11:27 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >> >>> Now,we got a new problem,like this--> >>> >>>> Association named ''publishers'' was not found; perhaps you misspelled it? >>>> >>>> >>> >>> On Wed, Sep 2, 2009 at 11:15 AM, Dhruva Sagar <dhruva.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >>> >>>> 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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <adam-K36Kqf6HJK7JKwlM9GxbOw@public.gmane.org> 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.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >>>>>> > 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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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! >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> -- >>> 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! >> >> >> >> >> > > > >-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi,DhruvaI had success with my code.Here is the code. controller code--> def index> @page_title = "Book List" > @books = Book.paginate :page => params[:page], > :per_page => 10, > :include => [:authors, :publisher], > :order => "books.id desc" > end >view code -->> dl id="books"> > <% for book in @books %> > <dt><%= book.title %></dt> > <% for author in book.authors %> > <dd><%= author.last_name %>, <%= author.first_name %></dd> > <% end %> > <dd><%= pluralize(book.page_count, "page") %></dd> > <dd>Priice: $<%=sprintf("%.2f", book.price) %></dd> > <dd><small>Publisher: <%= book.publisher.name %></small></dd> > <% end %> > </dl> > > <%= will_paginate @books , > :inner_window => 1, > :outer_window => 1, > :prev_label => ''Previous'', > :next_label => ''Next'' > %> >On Wed, Sep 2, 2009 at 11:49 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> We had got another failure--> > >> private method `scan'' called for 48756360:Fixnum >> >> > > > On Wed, Sep 2, 2009 at 11:42 AM, Dhruva Sagar <dhruva.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> In the statement, it should be :order => ''id'' and not :order => :id >> >> Thanks & Regards, >> Dhruva Sagar. >> >> >> Marie von Ebner-Eschenbach<http://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac.html> - "Even a stopped clock is right twice a day." >> >> On Wed, Sep 2, 2009 at 8:59 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >> >>> When i change ''publishers'' to ''publisher'',now we got like follow >>> >>> private method `scan'' called for :id:Symbol >>> >>> >>> >>> On Wed, Sep 2, 2009 at 11:27 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >>> >>>> Now,we got a new problem,like this--> >>>> >>>>> Association named ''publishers'' was not found; perhaps you misspelled it? >>>>> >>>>> >>>> >>>> On Wed, Sep 2, 2009 at 11:15 AM, Dhruva Sagar <dhruva.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >>>> >>>>> 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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <adam-K36Kqf6HJK7JKwlM9GxbOw@public.gmane.org> 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.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >>>>>>>> > 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! >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> -- >>>> 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! >>> >>> >>> >>> >>> >> >> >> >> > > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks a lot !You are good man. On Wed, Sep 2, 2009 at 12:06 PM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi,DhruvaI had success with my code.Here is the code. controller code--> > > def index >> @page_title = "Book List" >> @books = Book.paginate :page => params[:page], >> :per_page => 10, >> :include => [:authors, :publisher], >> :order => "books.id desc" >> end >> > view code --> > >> dl id="books"> >> <% for book in @books %> >> <dt><%= book.title %></dt> >> <% for author in book.authors %> >> <dd><%= author.last_name %>, <%= author.first_name %></dd> >> <% end %> >> <dd><%= pluralize(book.page_count, "page") %></dd> >> <dd>Priice: $<%=sprintf("%.2f", book.price) %></dd> >> <dd><small>Publisher: <%= book.publisher.name %></small></dd> >> <% end %> >> </dl> >> >> <%= will_paginate @books , >> :inner_window => 1, >> :outer_window => 1, >> :prev_label => ''Previous'', >> :next_label => ''Next'' >> %> >> > > > > > On Wed, Sep 2, 2009 at 11:49 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> We had got another failure--> >> >>> private method `scan'' called for 48756360:Fixnum >>> >>> >> >> >> On Wed, Sep 2, 2009 at 11:42 AM, Dhruva Sagar <dhruva.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >> >>> In the statement, it should be :order => ''id'' and not :order => :id >>> >>> Thanks & Regards, >>> Dhruva Sagar. >>> >>> >>> Marie von Ebner-Eschenbach<http://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac.html> - "Even a stopped clock is right twice a day." >>> >>> On Wed, Sep 2, 2009 at 8:59 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >>> >>>> When i change ''publishers'' to ''publisher'',now we got like follow >>>> >>>> private method `scan'' called for :id:Symbol >>>> >>>> >>>> >>>> On Wed, Sep 2, 2009 at 11:27 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >>>> >>>>> Now,we got a new problem,like this--> >>>>> >>>>>> Association named ''publishers'' was not found; perhaps you misspelled it? >>>>>> >>>>>> >>>>> >>>>> On Wed, Sep 2, 2009 at 11:15 AM, Dhruva Sagar <dhruva.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >>>>> >>>>>> 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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <adam-K36Kqf6HJK7JKwlM9GxbOw@public.gmane.org> 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.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 < >>>>>>>>> yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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! >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> 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! >>>> >>>> >>>> >>>> >>>> >>> >>> >>> >>> >> >> >> -- >> 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! > > >-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Your welcome, glad it helped :). Thanks & Regards, Dhruva Sagar. Charles de Gaulle<http://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html> - "The better I get to know men, the more I find myself loving dogs." On Wed, Sep 2, 2009 at 9:36 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks a lot !You are good man. > > > On Wed, Sep 2, 2009 at 12:06 PM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> Hi,DhruvaI had success with my code.Here is the code. controller code--> >> >> def index >>> @page_title = "Book List" >>> @books = Book.paginate :page => params[:page], >>> :per_page => 10, >>> :include => [:authors, :publisher], >>> :order => "books.id desc" >>> end >>> >> view code --> >> >>> dl id="books"> >>> <% for book in @books %> >>> <dt><%= book.title %></dt> >>> <% for author in book.authors %> >>> <dd><%= author.last_name %>, <%= author.first_name %></dd> >>> <% end %> >>> <dd><%= pluralize(book.page_count, "page") %></dd> >>> <dd>Priice: $<%=sprintf("%.2f", book.price) %></dd> >>> <dd><small>Publisher: <%= book.publisher.name %></small></dd> >>> <% end %> >>> </dl> >>> >>> <%= will_paginate @books , >>> :inner_window => 1, >>> :outer_window => 1, >>> :prev_label => ''Previous'', >>> :next_label => ''Next'' >>> %> >>> >> >> >> >> >> On Wed, Sep 2, 2009 at 11:49 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >> >>> We had got another failure--> >>> >>>> private method `scan'' called for 48756360:Fixnum >>>> >>>> >>> >>> >>> On Wed, Sep 2, 2009 at 11:42 AM, Dhruva Sagar <dhruva.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >>> >>>> In the statement, it should be :order => ''id'' and not :order => :id >>>> >>>> Thanks & Regards, >>>> Dhruva Sagar. >>>> >>>> >>>> Marie von Ebner-Eschenbach<http://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac.html> - "Even a stopped clock is right twice a day." >>>> >>>> On Wed, Sep 2, 2009 at 8:59 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >>>> >>>>> When i change ''publishers'' to ''publisher'',now we got like follow >>>>> >>>>> private method `scan'' called for :id:Symbol >>>>> >>>>> >>>>> >>>>> On Wed, Sep 2, 2009 at 11:27 AM, fireflyman <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >>>>> >>>>>> Now,we got a new problem,like this--> >>>>>> >>>>>>> Association named ''publishers'' was not found; perhaps you misspelled it? >>>>>>> >>>>>>> >>>>>> >>>>>> On Wed, Sep 2, 2009 at 11:15 AM, Dhruva Sagar <dhruva.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >>>>>> > wrote: >>>>>> >>>>>>> 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 <yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <adam-K36Kqf6HJK7JKwlM9GxbOw@public.gmane.org> 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.sagar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 < >>>>>>>>>> yangxiwenhuai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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! >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> 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! >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> -- >>> 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! >> >> >> > > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---