Hi Kurt, Robert, Thanks for the guidance, I will try it. Regards, Sachin
On Feb 23, 3:34 am, "[email protected]" <[email protected]> wrote: > On Feb 22, 5:34 am, SachinJ <[email protected]> wrote: > > > I have a Controller named Orders which has a pending_orders method > > which is expected to fetch some records from the database. > > > If i dont write a route for this method, I get the following error > > when i call this method. > > > Couldn't find Order with ID=pending_orders > > I am using rails 2.3.5, in the previous versions i use to get this > > I am not getting whether its new version requirement... > > So your route table has: > map.resources :orders > > But you also want > /orders/pending_orders > > rake routes shows: > order GET /orders/:id(.:format) > {:controller=>"orders", :action=>"show"} > > So when you are trying to do /orders/pending_orders, it is trying to > look up the id='pending_orders'. > Not what you want. > > http://guides.rubyonrails.org/routing.html > 3.11.2 Adding Collection Routes > > To add a collection route, use the :collection option: > > map.resources :photos, :collection => { :search => :get } > This will enable Rails to recognize URLs such as /photos/search using > the GET HTTP verb, and route them to the search action of the Photos > controller. It will also create a search_photos route helper. > > So you want: > map.resources :orders, :collection => { :pending_orders => :get } > > --- > Kurt Werle > I am looking for a new Rails job:http://www.CircleW.org/kurt/pages/resume -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

