Hello, I have set up an application using scaffolding, which have all basic method(index/new/edit/show/..). But when I tried to add a new method it showing routing errors. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class ItemsController < ApplicationController def index .. end def new .. end .... ... def list (New method which I have created) end end ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Error what I am getting is that, Couldn''t find Item with ID=list How can I configure my routes.rb to avoid the issue. Waiting for ur reply... -- 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 -~----------~----~----~----~------~----~------~--~---
which version of rails r u using ? -- 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 -~----------~----~----~----~------~----~------~--~---
Hi Sony - Have you specified the route in your routes.rb file? Try adding map.resources :items, :member => {:list => :get} or map.resources :items, :collection => {:list => :get} if this action is not for one specific object at a time. this will give you list_item_path(@item) or list_items_path That might help with the routing issue. Here''s a great tutorial on routes: http://guides.rubyonrails.org/routing_outside_in.html On Feb 20, 3:49 am, Sony Sebastian <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hello, > > I have set up an application using scaffolding, which have all > basic method(index/new/edit/show/..). But when I tried to add a new > method it showing routing errors. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > class ItemsController < ApplicationController > def index > .. > end > def new > .. > end > .... > ... > > def list > (New method which I have created) > end > > end > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Error what I am getting is that, > > Couldn''t find Item with ID=list > > How can I configure my routes.rb to avoid the issue. > > Waiting for ur reply... > -- > 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 -~----------~----~----~----~------~----~------~--~---