I tried to use the gem will_paginate but it doesn''t work as describs in manual Controller def index @sites = Site.paginate :per_page => 10, :page => params[:page] end View <% for @sites in @sites %> <%= @sites.naam %> <%= will_paginate @sites %> <% end %> Also i set require ''will_paginate'' below into the envoirment.rb Is there a way to get will_paginate working well or is there a better solution. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Sun, Jun 22, 2008 at 1:54 PM, GA Gorter <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I tried to use the gem will_paginate but it doesn''t work as describs in > manual > > Controller > > def index > @sites = Site.paginate :per_page => 10, :page => params[:page] > end > > > View > > <% for @sites in @sites %> > <%= @sites.naam %> > <%= will_paginate @sites %> > <% end %> > > Also i set require ''will_paginate'' below into the envoirment.rb > > Is there a way to get will_paginate working well or is there a better > solution.I''m guessing that you left off '':all'' in your code. try this: @sites = Site.paginate( :all, :per_page => 10, :page => params[:page] ) Good luck! Cheers, Robby -- Robby Russell Chief Evangelist, Partner PLANET ARGON, LLC design // development // hosting http://www.planetargon.com/ http://www.robbyonrails.com/ aim: planetargon +1 503 445 2457 +1 877 55 ARGON [toll free] +1 815 642 4068 [fax] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That makes no difference -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Jun 22, 9:54 pm, GA Gorter <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> <% for @sites in @sites %> > <%= @sites.naam %> > <%= will_paginate @sites %> > <% end %>that''s going to balls everything up: initially @sites is a will_paginate collection, but then you''re overwriting it with a single element from that collection. Also do you really want to be rendering the pagination links for each elements. Typically you would do someting like for sites in @sites ... (or use a partial, or @sites.each do | site| ...) Fred> > Also i set require ''will_paginate'' below into the envoirment.rb > > Is there a way to get will_paginate working well or is there a better > solution. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I wrote it exactly as in the railscasts http://railscasts.com/episodes/51 and the official manual http://rock.errtheblog.com/will_paginate even the require ''will_paginate'' i did Only without any result -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
But are you using "for @sites in @sites" or not? BTW, just in case, total_pages was recently added, it was called page_count before. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Xavier Noria wrote:> But are you using "for @sites in @sites" or not? > > BTW, just in case, total_pages was recently added, it was called > page_count before.Yes i''am using @sites for @sites when i''am using something different i got the same issue How can i fix total_pages the error contains into the gem -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Jun 23, 7:56 am, GA Gorter <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Xavier Noria wrote: > > But are you using "for @sites in @sites" or not? > > > BTW, just in case, total_pages was recently added, it was called > > page_count before. > > Yes i''am using @sites for @sites > > when i''am using something different i got the same issue >You''re not using it as in the examples. THe examples all go for site in @sites #do something with site end will_paginate @sites The way you do it can''t work because you are reassigning one of the sites to @sites, but will_paginate wants you to pass a collection, not an individual element. Fred> How can i fix total_pages the error contains into the gem > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
BEtter use paginate_find and faster pagination in rails using the below link http://www.igvita.com/2006/09/10/faster-pagination-in-rails/ Its better and effective. On Jun 23, 12:02 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> OnJun 23, 7:56 am, GA Gorter <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote:> Xavier Noria wrote: > > > But are you using "for @sites in @sites" or not? > > > > BTW, just in case, total_pages was recently added, it was called > > > page_count before. > > > Yes i''am using @sites for @sites > > > when i''am using something different i got the same issue > > You''re not using it as in the examples. THe examples all go > for site in @sites > #do something with site > end > > will_paginate @sites > > The way you do it can''t work because you are reassigning one of the > sites to @sites, but will_paginate wants you to pass a collection, not > an individual element. > > Fred > > > How can i fix total_pages the error contains into the gem > > -- > > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---