I''m trying to add original method "search" to the scaffolded controller. All the default standard methods in the controller (i.e. index, show, new, etc..). However, additional method "seach" is not recognized as method, and rather rails take the request as parameter with the following error message. url: http://127.0.0.1:3000/products/search ActiveRecord::RecordNotFound in ProductsController#show Couldn''t find Product with ID=search Changes I have made so far are: routes.rb map.search_product ''/products/search'', :controller => ''products'', :action => ''search'' Am I missing any setups?
Ryoichiro Kamiya
2009-Aug-16 15:26 UTC
Re: new method to controller being recognized as parameter instead
Kilari, Thanks a lot for help! I just added the route setting in the order you suggested. It indeed worked!! map.resource :products has been added by scaffolding at nearly beginning of the routes.rb, and I kept adding my own setting after those without much thinking.. thanks for advice! Regards, Ryo On Aug 16, 2009, at 7:52 PM, Kilari.co.in wrote:> Ryo, > > Add the following routes > map.connect '''', ''products/search'', :controller => > ''products'', :action => ''search'' > > Also make sure you add the map.resource :products next to it and not > above it. > > On Sun, Aug 16, 2009 at 1:38 PM, Ryo <ryoichiro.kamiya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > I''m trying to add original method "search" to the scaffolded > controller. All the default standard methods in the controller (i.e. > index, show, new, etc..). However, additional method "seach" is not > recognized as method, and rather rails take the request as parameter > with the following error message. > > url: http://127.0.0.1:3000/products/search > > ActiveRecord::RecordNotFound in ProductsController#show > Couldn''t find Product with ID=search > > Changes I have made so far are: > > routes.rb > map.search_product ''/products/search'', :controller => > ''products'', :action => ''search'' > > Am I missing any setups? > > > > > > -- > Thanks & Regards, > Kilari Vamsi Krishna > http://www.kilari.co.in > > > > "If u don''t want to be forgotten as soon as you are dead, either > write things worth reading or do things worth writing......"--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---