I have a nested route that doesn''t want to work for me. In my routes.rb I have: ///////////// map.resources :orders, :collection => { :archived => :get, :search => :post } do |orders| orders.resources :shipments, :collection => { :track => :get } orders.resources :addressbooks, :name_prefix => "order_" end ///////////// The problem is, I''m trying to access the track route using: track_shipment_path(order_id, id) which would translate to: /orders/33333/shipments/111;track but it''s saying undefined method `track_shipment_path'' I''ve accessed the :archived route this way, just can''t understand why the track route doesn''t work. Just wondering what I''m doing wrong. Thanks, Dave -- 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 -~----------~----~----~----~------~----~------~--~---
Hey, you''ve got ''track'' defined on the shipments collection so it would be: track_shipments_path(order_id) But seeing as the URL you quoted is for a shipments *member* (/orders/ 333/shipments/111;track), you probably want this: orders.resources :shipments, :member => {:track => :get} in which case, the helper would be (as you expected) track_shipment_path(order_id, id) HTH, Trevor On 4-Apr-07, at 8:04 PM, David Coleman wrote:> > I have a nested route that doesn''t want to work for me. > > In my routes.rb I have: > ///////////// > map.resources :orders, :collection => { :archived > => :get, :search => > :post } do |orders| > orders.resources :shipments, :collection => { :track => :get } > orders.resources :addressbooks, :name_prefix => "order_" > end > ///////////// > > The problem is, I''m trying to access the track route using: > track_shipment_path(order_id, id) > which would translate to: > /orders/33333/shipments/111;track > but it''s saying undefined method `track_shipment_path'' > > I''ve accessed the :archived route this way, just can''t understand why > the track route doesn''t work. > > Just wondering what I''m doing wrong. > > Thanks, > > Dave > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Trevor Squires wrote:> But seeing as the URL you quoted is for a shipments *member* (/orders/ > 333/shipments/111;track), you probably want this: > > orders.resources :shipments, :member => {:track => :get} > > in which case, the helper would be (as you expected) > track_shipment_path(order_id, id) > > HTH, > TrevorHi Trevor, That was exactly what I needed! Thanks. I''m having a hard time understanding the difference between a collection and a member. Will figure it out someday. Thanks again for your help! Dave -- 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 -~----------~----~----~----~------~----~------~--~---
David Coleman wrote:> I''m having a hard time understanding the difference > between a collection and a member. Will figure it out > someday.And that day is the day. I finally read the part of the peepcode rest cheatsheet that has collections & members on there. Learn something new everyday. -- 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 -~----------~----~----~----~------~----~------~--~---