Hello, How can I hide params on the URL? If I have the following resources, how can I hide the groups resources on the URL when showing posts? map.resources :groups do |groups| groups.resources :posts end Normally it will be groups/1/posts/1 I want the URL to show only posts/1 and have the group_id and controller_name invisible. Thanks, 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 -~----------~----~----~----~------~----~------~--~---
then don''t nest the resources map.resources :groups map.resources :posts On Nov 13, 10:58 am, elioncho <elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > > How can I hide params on the URL? If I have the following resources, > how can I hide the groups resources on the URL when showing posts? > > map.resources :groups do |groups| > groups.resources :posts > end > > Normally it will be groups/1/posts/1 > > I want the URL to show only posts/1 and have the group_id and > controller_name invisible. > > Thanks, > > 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 -~----------~----~----~----~------~----~------~--~---
Hi Jemminger, The thing is that I need that group_id to perform some queries on the posts_controller. Elías On Nov 13, 11:31 am, jemminger <jemmin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> then don''t nest the resources > > map.resources :groups > map.resources :posts > > On Nov 13, 10:58 am, elioncho <elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello, > > > How can I hide params on the URL? If I have the following resources, > > how can I hide the groups resources on the URL when showing posts? > > > map.resources :groups do |groups| > > groups.resources :posts > > end > > > Normally it will be groups/1/posts/1 > > > I want the URL to show only posts/1 and have the group_id and > > controller_name invisible. > > > Thanks, > > > 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 -~----------~----~----~----~------~----~------~--~---
Well, Long Version of the problem: I know that is impossible unless I have a session or maybe sending an extra param at the end of the url. The app I am creating is built around the concept of groups. So a user can belong to various groups and make posts and events on each of them. They also want the users profiles to stand-alone on the URL without the group preceding. So a user profile will show all his/her activity on all the groups. But then, If I am navigating through a group and click on a user who created and event I will be taken to he/she''s profile and all the menu links for group events and posts will be broken because those links where created with the group_id. So now I there''s no reference to which group I was navigating. That''s why I asked if maybe I could have it there but hidden. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
if your Post belongs_to a Group, then you can reference by @post.group_id On Nov 13, 3:30 pm, elioncho <elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Well, Long Version of the problem: > > I know that is impossible unless I have a session or maybe sending an > extra param at the end of the url. The app I am creating is built > around the concept of groups. So a user can belong to various groups > and make posts and events on each of them. They also want the users > profiles to stand-alone on the URL without the group preceding. So a > user profile will show all his/her activity on all the groups. But > then, If I am navigating through a group and click on a user who > created and event I will be taken to he/she''s profile and all the menu > links for group events and posts will be broken because those links > where created with the group_id. So now I there''s no reference to > which group I was navigating. That''s why I asked if maybe I could have > it there but hidden.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---