Hello, Well I am working on an app and wanted to make some changes on the URL''s. I have the following: #--- map.resources :groups do |groups| groups.resources :events, :member => { :invite => :get } end #--- So my events are mapping into: #--- www.xxx.com/groups/1/events/2 #--- What I want to do now is take out the ''group'' from there and only leave the id. Make it look like this: #--- www.xxx.com/1/events/2 #--- I tried something like the following and now I have an events_path route that works. #--- map.events '':group_id/events'', :controller => ''events'', :action => ''index'' #--- My question is: Should I then repeat this same line 5 times to map all the other actions? That without counting the member actions? map.events_new .... map.events_create... ... .. It just seems wrong and tedious. It''s there any other way to do this? Thanks for your attention, Elías --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hello, Any ideas, or is this not a very bright idea after all? Thanks, Elioncho On Nov 7, 3:55 pm, elioncho <elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > > Well I am working on an app and wanted to make some changes on the > URL''s. I have the following: > > #--- > map.resources :groups do |groups| > groups.resources :events, :member => { :invite => :get } > end > #--- > > So my events are mapping into: > > #---www.xxx.com/groups/1/events/2 > #--- > > What I want to do now is take out the ''group'' from there and only > leave the id. Make it look like this: > > #---www.xxx.com/1/events/2 > #--- > > I tried something like the following and now I have an events_path > route that works. > > #--- > map.events '':group_id/events'', :controller => ''events'', :action => > ''index'' > #--- > > My question is: Should I then repeat this same line 5 times to map all > the other actions? That without counting the member actions? > > map.events_new .... > map.events_create... > ... > .. > > It just seems wrong and tedious. It''s there any other way to do this? > > Thanks for your attention, > > Elías--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hmmm I am not pretty sure, but try checking the path_prefix and name_prefix methods. On 8 nov, 11:33, elioncho <elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > > Any ideas, or is this not a very bright idea after all? > > Thanks, > > Elioncho > > On Nov 7, 3:55 pm,elioncho<elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello, > > > Well I am working on an app and wanted to make some changes on the > > URL''s. I have the following: > > > #--- > > map.resources :groups do |groups| > > groups.resources :events, :member => { :invite => :get } > > end > > #--- > > > So my events are mapping into: > > > #---www.xxx.com/groups/1/events/2 > > #--- > > > What I want to do now is take out the ''group'' from there and only > > leave the id. Make it look like this: > > > #---www.xxx.com/1/events/2 > > #--- > > > I tried something like the following and now I have an events_path > > route that works. > > > #--- > > map.events '':group_id/events'', :controller => ''events'', :action => > > ''index'' > > #--- > > > My question is: Should I then repeat this same line 5 times to map all > > the other actions? That without counting the member actions? > > > map.events_new .... > > map.events_create... > > ... > > .. > > > It just seems wrong and tedious. It''s there any other way to do this? > > > Thanks for your attention, > > > Elías--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hello, Well I tried those methods, but that doesn''t solve the problem. It seems to me that when using map.resources there''s no way of taking the controller name out of there. I think the only way is mapping each routes independently, which I don''t and that will get long. Thanks, Elías On Nov 10, 10:33 am, bbtosurf <bbtos...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hmmm I am not pretty sure, but try checking the path_prefix and > name_prefix methods. > > On 8 nov, 11:33, elioncho <elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello, > > > Any ideas, or is this not a very bright idea after all? > > > Thanks, > > > Elioncho > > > On Nov 7, 3:55 pm,elioncho<elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hello, > > > > Well I am working on an app and wanted to make some changes on the > > > URL''s. I have the following: > > > > #--- > > > map.resources :groups do |groups| > > > groups.resources :events, :member => { :invite => :get } > > > end > > > #--- > > > > So my events are mapping into: > > > > #---www.xxx.com/groups/1/events/2 > > > #--- > > > > What I want to do now is take out the ''group'' from there and only > > > leave the id. Make it look like this: > > > > #---www.xxx.com/1/events/2 > > > #--- > > > > I tried something like the following and now I have an events_path > > > route that works. > > > > #--- > > > map.events '':group_id/events'', :controller => ''events'', :action => > > > ''index'' > > > #--- > > > > My question is: Should I then repeat this same line 5 times to map all > > > the other actions? That without counting the member actions? > > > > map.events_new .... > > > map.events_create... > > > ... > > > .. > > > > It just seems wrong and tedious. It''s there any other way to do this? > > > > Thanks for your attention, > > > > Elías > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hmmm, what I was trying to say in my last sentence is that mapping every route independently will be a tedious task. On Nov 10, 11:24 am, elioncho <elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > > Well I tried those methods, but that doesn''t solve the problem. It > seems to me that when using map.resources there''s no way of taking the > controller name out of there. I think the only way is mapping each > routes independently, which I don''t and that will get long. > > Thanks, > > Elías > > On Nov 10, 10:33 am, bbtosurf <bbtos...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hmmm I am not pretty sure, but try checking the path_prefix and > > name_prefix methods. > > > On 8 nov, 11:33, elioncho <elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hello, > > > > Any ideas, or is this not a very bright idea after all? > > > > Thanks, > > > > Elioncho > > > > On Nov 7, 3:55 pm,elioncho<elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hello, > > > > > Well I am working on an app and wanted to make some changes on the > > > > URL''s. I have the following: > > > > > #--- > > > > map.resources :groups do |groups| > > > > groups.resources :events, :member => { :invite => :get } > > > > end > > > > #--- > > > > > So my events are mapping into: > > > > > #---www.xxx.com/groups/1/events/2 > > > > #--- > > > > > What I want to do now is take out the ''group'' from there and only > > > > leave the id. Make it look like this: > > > > > #---www.xxx.com/1/events/2 > > > > #--- > > > > > I tried something like the following and now I have an events_path > > > > route that works. > > > > > #--- > > > > map.events '':group_id/events'', :controller => ''events'', :action => > > > > ''index'' > > > > #--- > > > > > My question is: Should I then repeat this same line 5 times to map all > > > > the other actions? That without counting the member actions? > > > > > map.events_new .... > > > > map.events_create... > > > > ... > > > > .. > > > > > It just seems wrong and tedious. It''s there any other way to do this? > > > > > Thanks for your attention, > > > > > Elías > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
So, path_prefix indeed worked. You can use: map.resources :events, :path_prefix => ''/:group_id'' and it works! Just in case, anyone encounters this in the future. On Nov 10, 11:26 am, elioncho <elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hmmm, what I was trying to say in my last sentence is that mapping > every route independently will be a tedious task. > > On Nov 10, 11:24 am,elioncho<elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello, > > > Well I tried those methods, but that doesn''t solve the problem. It > > seems to me that when using map.resources there''s no way of taking the > > controller name out of there. I think the only way is mapping each > > routes independently, which I don''t and that will get long. > > > Thanks, > > > Elías > > > On Nov 10, 10:33 am, bbtosurf <bbtos...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hmmm I am not pretty sure, but try checking the path_prefix and > > > name_prefix methods. > > > > On 8 nov, 11:33,elioncho<elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hello, > > > > > Any ideas, or is this not a very bright idea after all? > > > > > Thanks, > > > > >Elioncho > > > > > On Nov 7, 3:55 pm,elioncho<elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Hello, > > > > > > Well I am working on an app and wanted to make some changes on the > > > > > URL''s. I have the following: > > > > > > #--- > > > > > map.resources :groups do |groups| > > > > > groups.resources :events, :member => { :invite => :get } > > > > > end > > > > > #--- > > > > > > So my events are mapping into: > > > > > > #---www.xxx.com/groups/1/events/2 > > > > > #--- > > > > > > What I want to do now is take out the ''group'' from there and only > > > > > leave the id. Make it look like this: > > > > > > #---www.xxx.com/1/events/2 > > > > > #--- > > > > > > I tried something like the following and now I have an events_path > > > > > route that works. > > > > > > #--- > > > > > map.events '':group_id/events'', :controller => ''events'', :action => > > > > > ''index'' > > > > > #--- > > > > > > My question is: Should I then repeat this same line 5 times to map all > > > > > the other actions? That without counting the member actions? > > > > > > map.events_new .... > > > > > map.events_create... > > > > > ... > > > > > .. > > > > > > It just seems wrong and tedious. It''s there any other way to do this? > > > > > > Thanks for your attention, > > > > > > Elías > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---