This is a great idea. I always make mini projects to learn new functionality and then move it to my main project when I've got it working right.
On Fri, Oct 30, 2009 at 9:25 AM, Rick <richard.t.ll...@gmail.com> wrote: > > I would suggest that you start a new app just to learn how to use > pagination. RailsSpace is a good tutorial but there are several > "version of..." issues embedded in the code. Pagination is one. > > 1) "gem install mislav-will_paginate" > (or "sudo gem install mislav-will_paginate" if you must) > > NOTE: this is not the same gem as will_paginate. > > 2) Go to "http://github.com/mislav/will_paginate/blob/master/ > README.rdoc" and keep this page up in your browser as you follow the > instructions. > > 3) run "rails pagin" and create a throw-away app that will just > do pagination. I would suggest that you just have one model - Word - > and create a word index that paginates 10 words per page, then get > fancy and sort the words. > > The simplest way to go is to have your words_controller.rb include: > > require 'will_paginate' > > def index > #...@words = Word.all > @words = Word.paginate :page => :params[:page], :per_page => 10 > . > . > . > > And to have your index.html.erb include: > > <h1>Listing words</h1> > <%= will_paginate @words %> > . > . > . > > NOTE: there appears to be a bug related to the view pagination > controls under Ruby 1.9 - all's good with 1.8 however. > > On Oct 28, 5:56 pm, RubyonRails_newbie <craigwest...@googlemail.com> > wrote: > > that's what I am reading, and the code in there hasn't helped solve > > this issue! > > > > On 28 Oct, 21:53, Conrad Taylor <conra...@gmail.com> wrote: > > > > > On Wed, Oct 28, 2009 at 6:56 AM, RubyonRails_newbie < > > > > > craigwest...@googlemail.com> wrote: > > > > > > Hi there, > > > > > > I have managed to overcome my search issue, and now I am able to > > > > return users successfully. > > > > > > I am now trying to paginate the results, so only 10 are displayed on > > > > each page. > > > > > > The paginate example in the RailsSpace book doesn’t work in my > version > > > > of rails (2.3.3). So – my question is: > > > > > > Has anyone had this issue, and if so how was it overcome? > > > > > > Or > > > > > > Is there a simpler way to implement this to tidy the results up > > > > > > Many Thanks > > > > > > I'm not too hot with Ruby on Rails yet, so if anyone can help, in a > > > > simple explanation kinda way, that would be cool! :-) > > > > > If you're working your way through RailsSpace, then I would recommend > > > reading this: > > > > >http://railsspace.com/ > > > > > Good luck, > > > > > -Conrad > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---