# What is the best approach?

**URL:** <https://www.ruby-forum.com/t/what-is-the-best-approach/153060>\
**Category:** Rails\
**Created:** [November 11, 2008, 5:51pm UTC](https://www.ruby-forum.com/t/what-is-the-best-approach/153060 "2008-11-11T17:51:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [November 11, 2008, 5:51pm UTC](https://www.ruby-forum.com/t/what-is-the-best-approach/153060/1 "2008-11-11T17:51:19Z")

</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://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [November 11, 2008, 10:40pm UTC](https://www.ruby-forum.com/t/what-is-the-best-approach/153060/2 "2008-11-11T22:40:34Z")

</div>

Any ideas?

---

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [November 11, 2008, 11:29pm UTC](https://www.ruby-forum.com/t/what-is-the-best-approach/153060/3 "2008-11-11T23:29:25Z")

</div>

> Any ideas?  
> Have you looked into nested resources?

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

POST: [XXX Sex - Free Porn Videos at XXX.com](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

map.resources :groups has\_many =\> :posts
