julien.guimont-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Dec-20 18:30 UTC
Mix Resources and non Resource routes
Hello, I have this routing right now: map.resources :events do |event| event.resources :invitations event.resources :personalized_invitations event.resources :questions end Now I want to add to the event resource other non resourceful routes. In my case, this new route will be for my notification controller. Per se notifications belongs to an event but are not resources so I don''t want to use: event.resources :notifications, :member=>[my notif actions here] I would like the notification controller to behave as the default rails routing but within the event scope. Something like this: event.connect '':controller/:action/:id'' and then be able to have this kind of URL: http://localhost:3000/events/notification/send/1 Is it possible to have such routing? How can I do this? Thank you, Julien. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Use named route: map.notification ''events/notification/send/:id'', :controller => ''ur_controller_name'', :action => ''send'' The new way declaring your routes is: map.resources :events , :has_many => [:invitations, :personalized_invitations, :questions] On Dec 20, 2007 10:30 AM, julien.guimont-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <julien.guimont-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello, > > I have this routing right now: > > map.resources :events do |event| > event.resources :invitations > event.resources :personalized_invitations > event.resources :questions > end > > Now I want to add to the event resource other non resourceful routes. > In my case, this new route will be for my notification controller. Per > se notifications belongs to an event but are not resources so I don''t > want to use: > > event.resources :notifications, :member=>[my notif actions here] > > I would like the notification controller to behave as the default > rails routing but within the event scope. Something like this: > event.connect '':controller/:action/:id'' > > and then be able to have this kind of URL: > http://localhost:3000/events/notification/send/1 > > Is it possible to have such routing? How can I do this? > >-- http://www.rubyplus.org/ Free Ruby Screencasts --~--~---------~--~----~------------~-------~--~----~ 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, Bala Paranj wrote:> Use named route: > > map.notification ''events/notification/send/:id'', :controller => > ''ur_controller_name'', :action => ''send'' > > The new way declaring your routes is: > > map.resources :events , :has_many => [:invitations, > :personalized_invitations, :questions]Sorry but, how can then you relate this map.resources :events with the previous map.notification named routes created? I mean, you are not mixing. You are just creating a named route with the same first path as map.resources :events. -- 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 -~----------~----~----~----~------~----~------~--~---