Hello everyone, I am working on an app where the url needs to begin with the group_id because the user will always navigate inside a group, its events and posts. http://xxx.com/groups/1... My question is: What is the best way to separate the group posts from the posts that a particular user created for that group. I am using right now the posts index to show all the group posts. Now I want to show all the posts from a specific user on that group. 1) Should I create a new controller ? 2) A new action for the posts controller ? 3) Or maybe send an extra param to the posts index action to know if I should display the group posts or the user posts on the group. That''s the three choices I have think about, what its the best thing to do or is there any other option? Thanks, Elias --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Any ideas? On Nov 11, 11:50 am, elioncho <elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello everyone, > > I am working on an app where the url needs to begin with the group_id > because the user will always navigate inside a group, its events and > posts. > > http://xxx.com/groups/1... > > My question is: > > What is the best way to separate the group posts from the posts that a > particular user created for that group. > > I am using right now the posts index to show all the group posts. Now > I want to show all the posts from a specific user on that group. > > 1) Should I create a new controller ? > 2) A new action for the posts controller ? > 3) Or maybe send an extra param to the posts index action to know if I > should display the group posts or the user posts on the group. > > That''s the three choices I have think about, what its the best thing > to do or is there any other option? > > Thanks, > > Elias--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> Any ideas?Have you looked into nested resources? GET: http://xxx.com/groups/1/posts POST: http://xxx.com/groups/1/posts PUT: http://xxx.com/groups/1/posts/1 DELETE: http://xxx.com/groups/1/posts/1 routes.rb -------------------- map.resources :groups has_many => :posts -- 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 -~----------~----~----~----~------~----~------~--~---