@models=Model.find_all @model_pages,@models=paginate @models,:per_page=>10 ofcourse above is wrong is there any way to do like that in rails ? actually i have created my own Class method in Model.rb . From that i can get array of model object. i want to paginate that any idea ... -- 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 -~----------~----~----~----~------~----~------~--~---
http://wiki.rubyonrails.org/rails/pages/PaginationHelper http://wiki.rubyonrails.org/rails/pages/HowtoPagination Also check out for will_paginate plugin Pokkai Dokkai wrote:> @models=Model.find_all > @model_pages,@models=paginate @models,:per_page=>10 > > ofcourse above is wrong > > is there any way to do like that in rails ? > > actually i have created my own Class method in Model.rb . > From that i can get array of model object. > > i want to paginate that > > > any idea ...-- 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 -~----------~----~----~----~------~----~------~--~---
In controller: @models = Model.paginate :page => params[:page], :per_page => PAGE_SIZE, :conditions => yr_condition In View: <%= will_paginate @models %> Before this as a first step install will_paginate plugin since pagination concept is removed from core rails 2.0 and released as a plugin U can install the plugin by typing this navigating to the project folder (example: E:\My Rails Application>ruby script/plugin install svn://errtheblog.com/svn/plugins/will_paginate) -- 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 -~----------~----~----~----~------~----~------~--~---
Ratnavel Sundaramurthi wrote:> In controller: > > @models = Model.paginate :page => params[:page], :per_page => PAGE_SIZE, > :conditions => yr_condition > > In View: > > <%= will_paginate @models %> > > Before this as a first step install will_paginate plugin since > pagination concept is removed from core rails 2.0 and released as a > plugin > > U can install the plugin by typing this navigating to the project folder > > (example: > E:\My Rails Application>ruby script/plugin install > svn://errtheblog.com/svn/plugins/will_paginate)what about if i using params[:variable] in the case of getting my collection like that @users=User.find(:all,:conditions=>["sex=?",params[:sex]]) -- 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 -~----------~----~----~----~------~----~------~--~---
What version of Rails are you using? Pagination has been taken out of the core and put into a plugin as of Rails 2.0. It''s now recommended to use will_paginate as a replacement. On Dec 20, 2007 12:53 AM, Pokkai Dokkai <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Ratnavel Sundaramurthi wrote: > > In controller: > > > > @models = Model.paginate :page => params[:page], :per_page => PAGE_SIZE, > > :conditions => yr_condition > > > > In View: > > > > <%= will_paginate @models %> > > > > Before this as a first step install will_paginate plugin since > > pagination concept is removed from core rails 2.0 and released as a > > plugin > > > > U can install the plugin by typing this navigating to the project folder > > > > (example: > > E:\My Rails Application>ruby script/plugin install > > svn://errtheblog.com/svn/plugins/will_paginate) > > what about if i using params[:variable] in the case of getting my > collection > like that > > @users=User.find(:all,:conditions=>["sex=?",params[:sex]]) > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---