Hi Friends, I am very new to RoR. I have now got the pager working for my listing page and was trying to get the sorting to work. However I get this error: MissingSourceFile in PeopleController#index Missing helper file helpers/sorting_helper.rb RAILS_ROOT: C:/ruby/contact Application Trace | Framework Trace | Full Trace C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ helpers.rb:127:in `helper'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ helpers.rb:111:in `each'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ helpers.rb:111:in `helper'' app/controllers/people_controller.rb:3 Following is the code in the controller: def index @sorter = SortingHelper::Sorter.new self, %w(name address), @params[''sort''], @params[''order''], ''name'', ''ASC'' @people = Person.search(params[:search], params[:page]) end following is the code in the view: <h1>Listing people</h1> <table> <tr> <th><%= link_to ''Name'', @sorter.to_link(''name'') %></th> <th><%= link_to ''Address'', @sorter.to_link(''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 %> following is the code in the model: class Person < ActiveRecord::Base # models/product.rb def self.search(search, page) paginate :per_page => 5, :page => page, :conditions => [''name like ?'', "%#{search}%"], :order => ''name'' end end i also added this line to the routes.rb map.connect '':controller/:action/:sort/:order'' Looking forward to your help yet again.....:) ----------------------------------------------------------------------------------------------------------------------------------- Thanks, 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 -~----------~----~----~----~------~----~------~--~---
guys do i have to download and install any gem for this just like the way i did for pagination? On Apr 18, 1:49 pm, durgesh <Manguesh.Bor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Friends, > > I am very new to RoR. I have now got the pager working for my > listing page and was trying to get the sorting to work. However I get > this error: > > MissingSourceFile in PeopleController#index > Missing helper file helpers/sorting_helper.rb > RAILS_ROOT: C:/ruby/contact > > Application Trace | Framework Trace | Full Trace > C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ > helpers.rb:127:in `helper'' > C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ > helpers.rb:111:in `each'' > C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ > helpers.rb:111:in `helper'' > app/controllers/people_controller.rb:3 > > Following is the code in the controller: > > def index > @sorter = SortingHelper::Sorter.new self, %w(name address), > @params[''sort''], @params[''order''], ''name'', ''ASC'' > @people = Person.search(params[:search], params[:page]) > end > > following is the code in the view: > > <h1>Listing people</h1> > > <table> > <tr> > <th><%= link_to ''Name'', @sorter.to_link(''name'') %></th> > <th><%= link_to ''Address'', @sorter.to_link(''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 %> > > following is the code in the model: > > class Person < ActiveRecord::Base > > # models/product.rb > def self.search(search, page) > paginate :per_page => 5, :page => page, > :conditions => [''name like ?'', "%#{search}%"], > :order => ''name'' > end > > end > > i also added this line to the routes.rb > > map.connect '':controller/:action/:sort/:order'' > > Looking forward to your help yet again.....:) > > ----------------------------------------------------------------------------------------------------------------------------------- > Thanks, > 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 -~----------~----~----~----~------~----~------~--~---
have you install the plugin? ruby script/plugin install svn://errtheblog.com/svn/plugins/will_paginate and dont forget to ensure that you install svn in your OS. Try to ask google how to install SVN in your OS. Reinhart http://teapoci.blogspot.com -- 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 -~----------~----~----~----~------~----~------~--~---
well i would prefer to install a gem rather than do it through the plugin........, can anyone please tell me how to do that? On Apr 18, 2:26 pm, Visit Indonesia 2008 <rails-mailing-l...@andreas- s.net> wrote:> have you install the plugin? > > ruby script/plugin install > svn://errtheblog.com/svn/plugins/will_paginate > > and dont forget to ensure that you install svn in your OS. Try to ask > google how to install SVN in your OS. > > Reinharthttp://teapoci.blogspot.com > -- > 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 -~----------~----~----~----~------~----~------~--~---