What is the best approach?

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.

XXX Sex - Free Porn Videos at XXX.com

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

Any ideas?

Any ideas?
Have you looked into nested resources?

GET: XXX Sex - Free Porn Videos at XXX.com

POST: XXX Sex - Free Porn Videos at XXX.com

PUT: XXX Sex - Free Porn Videos at XXX.com

DELETE: XXX Sex - Free Porn Videos at XXX.com

routes.rb

map.resources :groups has_many => :posts