Hi Folks, I am just trying to get started up in RoR, I have done a simple application of add, edit, delete.... I am now trying to accomplish pagination in RoR, I referred a few tutorials, however none of the examples that i tried from there, seemed to work error free..... I have heard that lots of things have deprecated in RoR, can someone please post me a detailed report of how i can setup a pager in RoR, i mean the most straightforward and simple way to do it... I am using ruby 1.8.6 Looking forward to help from all u guys... Thanks and Regards, Durgesh. --~--~---------~--~----~------------~-------~--~----~ 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 will_paginate, and you''ll love it. durgesh wrote:> Hi Folks, > > I am just trying to get started up in RoR, I have done a simple > application of add, edit, delete.... > > > I am now trying to accomplish pagination in RoR, I referred a few > tutorials, however none of the examples that i tried from there, > seemed to work error free..... I have heard that lots of things have > deprecated in RoR, can someone please post me a detailed report of how > i can setup a pager in RoR, i mean the most straightforward and simple > way to do it... > > I am using ruby 1.8.6 > > Looking forward to help from all u guys... > > Thanks and Regards, > Durgesh.--~--~---------~--~----~------------~-------~--~----~ 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, You can generate scaffolding for a model (ruby script/generate scaffold <modelname>) and examine the resulting code - it should contain support for pagination. Be careful so you don''t tell it to overwrite any files you care about! Cheers -- 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 -~----------~----~----~----~------~----~------~--~---
previous versions of rails < 2.x the pegination was built in with the classic pegination. but with rails2.0 it removed from the rails core. You need to look at the classic peginatior which is a built in for rails 1.8.x. or you can use a plugin like will_peginator On Apr 16, 3:19 pm, durgesh <Manguesh.Bor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Folks, > > I am just trying to get started up in RoR, I have done a simple > application of add, edit, delete.... > > I am now trying to accomplish pagination in RoR, I referred a few > tutorials, however none of the examples that i tried from there, > seemed to work error free..... I have heard that lots of things have > deprecated in RoR, can someone please post me a detailed report of how > i can setup a pager in RoR, i mean the most straightforward and simple > way to do it... > > I am using ruby 1.8.6 > > Looking forward to help from all u guys... > > Thanks and Regards, > Durgesh.--~--~---------~--~----~------------~-------~--~----~ 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 are using will_paginate in the Rails 2 version of our BuildingWebApps.com site. I like it a lot better than the classic version. This article, starting halfway down got us going pretty well: http://nasir.wordpress.com/2007/10/31/pagination-in-ruby-on-rails-using-will_paginate-plugin/ -Christopher On Apr 16, 3:59 am, Nuwan Chaturanga <webnu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> previous versions of rails < 2.x the pegination was built in with the > classic pegination. but with rails2.0 it removed from the rails core. > You need to look at the classic peginatior which is a built in for > rails 1.8.x. or you can use a plugin like will_peginator > > On Apr 16, 3:19 pm, durgesh <Manguesh.Bor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi Folks, > > > I am just trying to get started up in RoR, I have done a simple > > application of add, edit, delete.... > > > I am now trying to accomplish pagination in RoR, I referred a few > > tutorials, however none of the examples that i tried from there, > > seemed to work error free..... I have heard that lots of things have > > deprecated in RoR, can someone please post me a detailed report of how > > i can setup a pager in RoR, i mean the most straightforward and simple > > way to do it... > > > I am using ruby 1.8.6 > > > Looking forward to help from all u guys... > > > Thanks and Regards, > > Durgesh.--~--~---------~--~----~------------~-------~--~----~ 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 was trying to install will_paginate, however i do not have svn on my machine...i tried the following commands: ruby script/plugin install svn://errtheblog.com/svn/plugins/will_paginate can anyone please tell me how i can install the will_paginate plugin without svn? On Apr 16, 5:41 pm, Chris Haupt <cfhdistantea...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> We are using will_paginate in the Rails 2 version of our > BuildingWebApps.com site. I like it a lot better than the classic > version. This article, starting halfway down got us going pretty well: > > http://nasir.wordpress.com/2007/10/31/pagination-in-ruby-on-rails-usi... > > -Christopher > > On Apr 16, 3:59 am, Nuwan Chaturanga <webnu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > previous versions of rails < 2.x the pegination was built in with the > > classic pegination. but with rails2.0 it removed from the rails core. > > You need to look at the classic peginatior which is a built in for > > rails 1.8.x. or you can use a plugin like will_peginator > > > On Apr 16, 3:19 pm, durgesh <Manguesh.Bor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi Folks, > > > > I am just trying to get started up in RoR, I have done a simple > > > application of add, edit, delete.... > > > > I am now trying to accomplish pagination in RoR, I referred a few > > > tutorials, however none of the examples that i tried from there, > > > seemed to work error free..... I have heard that lots of things have > > > deprecated in RoR, can someone please post me a detailed report of how > > > i can setup a pager in RoR, i mean the most straightforward and simple > > > way to do it... > > > > I am using ruby 1.8.6 > > > > Looking forward to help from all u guys... > > > > Thanks and Regards, > > > Durgesh.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 durgesh wrote: | i was trying to install will_paginate, however i do not have svn on my | machine...i tried the following commands: | ruby script/plugin | install svn://errtheblog.com/svn/plugins/will_paginate | | can anyone please tell me how i can install the will_paginate plugin | without svn? PS C:\Documents and Settings\CynicalRyan> gem search will_paginate -r *** REMOTE GEMS *** Updating metadata for 27 gems from http://gems.rubyforge.org/ ........................... complete will_paginate (2.2.1) - -- Phillip Gawlowski Twitter: twitter.com/cynicalryan ~ - You know you''ve been hacking too long when... ...you start reading car license plates as machine code. JMP 451, HCF 919 (this one really shook me up), HLT 772 (Halt instruction...gotta reboot the truck again!), FOXXY (um, don''t know that one...must be a floating point instruction). -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkgHFPIACgkQbtAgaoJTgL/yRgCdGsnUit0VmcYCpn6oOlWMws83 B9kAn3c36Wy1K7v3r3pgK++9YQdJ3gDB =wKpj -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
i get the following error: ERROR: while executing gem ... <Gem::RemoteFetcher::FetchError> A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. -connect<2> <Errno::ETIMEDOUT> getting size of http://gems.rubyforge.org/Marshal.4.8 On Apr 17, 10:14 am, Phillip Gawlowski <cmdjackr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > durgesh wrote: > > | i was trying to install will_paginate, however i do not have svn on my > | machine...i tried the following commands: > | ruby script/plugin > | install svn://errtheblog.com/svn/plugins/will_paginate > | > | can anyone please tell me how i can install the will_paginate plugin > | without svn? > > PS C:\Documents and Settings\CynicalRyan> gem search will_paginate -r > > *** REMOTE GEMS *** > > Updating metadata for 27 gems fromhttp://gems.rubyforge.org/ > ........................... > complete > will_paginate (2.2.1) > > - -- > Phillip Gawlowski > Twitter: twitter.com/cynicalryan > > ~ - You know you''ve been hacking too long when... > ...you start reading car license plates as machine code. JMP 451, HCF 919 > (this one really shook me up), HLT 772 (Halt instruction...gotta reboot the > truck again!), FOXXY (um, don''t know that one...must be a floating point > instruction). > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.8 (MingW32) > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org > > iEYEARECAAYFAkgHFPIACgkQbtAgaoJTgL/yRgCdGsnUit0VmcYCpn6oOlWMws83 > B9kAn3c36Wy1K7v3r3pgK++9YQdJ3gDB > =wKpj > -----END PGP SIGNATURE-------~--~---------~--~----~------------~-------~--~----~ 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 i got the will_paginate gem to sucessfully installe: now when i try to use the pagination i get the following error in the browser: NoMethodError in PeopleController#index undefined method `paginate'' for Person(id: integer, name: string, address: text):Class RAILS_ROOT: C:/ruby/contact Application Trace | Framework Trace | Full Trace C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ base.rb:1532:in `method_missing'' app/models/person.rb:7:in `search'' app/controllers/people_controller.rb:5:in `index'' this is the pagination code in controller: def index @people = Person.search(params[:search], params[:page]) end this is the code in the model i.e person.rb def self.search(search, page) paginate :per_page => 5, :page => page, :conditions => [''name like ?'', "%#{search}%"], :order => ''name'' end and this is the code in the index.html.erb: <h1>Listing people</h1> <table> <tr> <th>Name</th> <th>Address</th> </tr> <% for person in @people %> <tr> <td><%=h person.name %></td> <td><%=h person.address %></td> <td><%= link_to ''Show'', person %></td> <td><%= link_to ''Edit'', edit_person_path(person) %></td> <td><%= link_to ''Destroy'', person, :confirm => ''Are you sure?'', :method => :delete %></td> </tr> <% end %> </table> <br /> <!-- products/index.rhtml --> <%= will_paginate @people %> <%= link_to ''New person'', new_person_path %> Guys, does anyone know what mistake i might have made? On Apr 17, 11:39 am, durgesh <Manguesh.Bor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> i get the following error: > > ERROR: while executing gem ... <Gem::RemoteFetcher::FetchError> > A connection attempt failed because the connected party did not > properly respond after a period of time, or established connection > failed because connected host has failed to respond. -connect<2> > <Errno::ETIMEDOUT> > getting size ofhttp://gems.rubyforge.org/Marshal.4.8 > > On Apr 17, 10:14 am, Phillip Gawlowski <cmdjackr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > durgesh wrote: > > > | i was trying to install will_paginate, however i do not have svn on my > > | machine...i tried the following commands: > > | ruby script/plugin > > | install svn://errtheblog.com/svn/plugins/will_paginate > > | > > | can anyone please tell me how i can install the will_paginate plugin > > | without svn? > > > PS C:\Documents and Settings\CynicalRyan> gem search will_paginate -r > > > *** REMOTE GEMS *** > > > Updating metadata for 27 gems fromhttp://gems.rubyforge.org/ > > ........................... > > complete > > will_paginate (2.2.1) > > > - -- > > Phillip Gawlowski > > Twitter: twitter.com/cynicalryan > > > ~ - You know you''ve been hacking too long when... > > ...you start reading car license plates as machine code. JMP 451, HCF 919 > > (this one really shook me up), HLT 772 (Halt instruction...gotta reboot the > > truck again!), FOXXY (um, don''t know that one...must be a floating point > > instruction). > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1.4.8 (MingW32) > > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org > > > iEYEARECAAYFAkgHFPIACgkQbtAgaoJTgL/yRgCdGsnUit0VmcYCpn6oOlWMws83 > > B9kAn3c36Wy1K7v3r3pgK++9YQdJ3gDB > > =wKpj > > -----END PGP SIGNATURE-------~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 durgesh wrote: | ok i got the will_paginate gem to sucessfully installe: now when i try | to use the pagination i get the following error in the browser: Don''t you think that actively looking for will_paginate''s documentation might help? That approach turned up the following site: http://github.com/mislav/will_paginate/wikis/installation Which, oddly enough, tells you how to use will_paginate. - -- Phillip Gawlowski Twitter: twitter.com/cynicalryan ~ "I suppose if we couldn''t laugh at things that don''t make sense, we couldn''t react to a lot of life." -Hobbes -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkgHO6sACgkQbtAgaoJTgL+5igCgiVfiVufrn1VkAzL1ij9o9l9Q s+oAoJzbyjZDbhEua1oRhPiohlH3GJdm =oKad -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
friends, thanks a lot for all the help offererd so far.....however, i am getting the same error, even after following the instructions: undefined method `paginate'' for Person(id: integer, name: string, address: text):Class RAILS_ROOT: C:/ruby/contact Application Trace | Framework Trace | Full Trace C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ base.rb:1532:in `method_missing'' app/models/person.rb:7:in `search'' app/controllers/people_controller.rb:5:in `index'' this is the pagination code in controller: def index @people = Person.search(params[:search], params[:page]) end this is the code in the model i.e person.rb def self.search(search, page) paginate :per_page => 5, :page => page, :conditions => [''name like ?'', "%#{search}%"], :order => ''name'' end and this is the code in the index.html.erb: <h1>Listing people</h1> <table> <tr> <th>Name</th> <th>Address</th> </tr> <% for person in @people %> <tr> <td><%=h person.name %></td> <td><%=h person.address %></td> <td><%= link_to ''Show'', person %></td> <td><%= link_to ''Edit'', edit_person_path(person) %></td> <td><%= link_to ''Destroy'', person, :confirm => ''Are you sure?'', :method => :delete %></td> </tr> <% end %> </table> <br /> <!-- products/index.rhtml --> <%= will_paginate @people %> <%= link_to ''New person'', new_person_path %> Guys, does anyone know what mistake i might have made? please do help On Apr 17, 12:59 pm, Phillip Gawlowski <cmdjackr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > durgesh wrote: > > | ok i got the will_paginate gem to sucessfully installe: now when i try > | to use the pagination i get the following error in the browser: > > Don''t you think that actively looking for will_paginate''s documentation > might help? > > That approach turned up the following site:http://github.com/mislav/will_paginate/wikis/installation > > Which, oddly enough, tells you how to use will_paginate. > > - -- > Phillip Gawlowski > Twitter: twitter.com/cynicalryan > > ~ "I suppose if we couldn''t laugh at things that don''t make sense, we > couldn''t react to a lot of life." -Hobbes > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.8 (MingW32) > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org > > iEYEARECAAYFAkgHO6sACgkQbtAgaoJTgL+5igCgiVfiVufrn1VkAzL1ij9o9l9Q > s+oAoJzbyjZDbhEua1oRhPiohlH3GJdm > =oKad > -----END PGP SIGNATURE-------~--~---------~--~----~------------~-------~--~----~ 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 17 Apr 2008, at 14:14, durgesh wrote:> > friends, thanks a lot for all the help offererd so far.....however, i > am getting the same error, even after following the instructions: >Did you add the require ''will_paginate'' in your environment, like it says in the docs ? Fred --~--~---------~--~----~------------~-------~--~----~ 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 buddies, really very thankful to all of u...the problem was coming becoz i did not restart the webrick server after pasting the lines into the config/environment.rb...after i did that....things worked!! thanks once again to all of u....looking forward to your help in future too.... :) On Apr 17, 3:07 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 17 Apr 2008, at 14:14, durgesh wrote: > > > > > friends, thanks a lot for all the help offererd so far.....however, i > > am getting the same error, even after following the instructions: > > Did you add the require ''will_paginate'' in your environment, like it > says in the docs ? > > Fred--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---