# What is the best approach?

**URL:** <https://discuss.rubyonrails.org/t/what-is-the-best-approach/36255>\
**Category:** rubyonrails-talk\
**Created:** [November 11, 2008, 4:50pm UTC](https://discuss.rubyonrails.org/t/what-is-the-best-approach/36255 "2008-11-11T16:50:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elioncho](https://avatars.discourse-cdn.com/v4/letter/e/ed8c4c/32.png) [@elioncho](https://discuss.rubyonrails.org/u/elioncho)\
**Post date:** [November 11, 2008, 4:50pm UTC](https://discuss.rubyonrails.org/t/what-is-the-best-approach/36255/1 "2008-11-11T16:50:17Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![elioncho](https://avatars.discourse-cdn.com/v4/letter/e/ed8c4c/32.png) [@elioncho](https://discuss.rubyonrails.org/u/elioncho)\
**Post date:** [November 11, 2008, 9:39pm UTC](https://discuss.rubyonrails.org/t/what-is-the-best-approach/36255/2 "2008-11-11T21:39:52Z")

</div>

Any ideas?

---

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [November 11, 2008, 10:29pm UTC](https://discuss.rubyonrails.org/t/what-is-the-best-approach/36255/3 "2008-11-11T22:29:25Z")

</div>

> Any ideas?

Have you looked into nested resources?

GET: [http://xxx.com/groups/1/posts](http://xxx.com/groups/1/posts)

POST: [http://xxx.com/groups/1/posts](http://xxx.com/groups/1/posts)

PUT: [XXX Sex - Free Porn Videos at XXX.com](http://xxx.com/groups/1/posts/1)

DELETE: [XXX Sex - Free Porn Videos at XXX.com](http://xxx.com/groups/1/posts/1)

routes.rb
