# Meaningless REST resources for n:n relationships

**URL:** <https://www.ruby-forum.com/t/meaningless-rest-resources-for-n-n-relationships/143707>\
**Category:** Rails\
**Created:** [July 22, 2008, 1:12am UTC](https://www.ruby-forum.com/t/meaningless-rest-resources-for-n-n-relationships/143707 "2008-07-22T01:12:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [July 22, 2008, 1:12am UTC](https://www.ruby-forum.com/t/meaningless-rest-resources-for-n-n-relationships/143707/1 "2008-07-22T01:12:52Z")

</div>

Hello all,

I’m designing a Rails application that has a Group resource that habtm  
Permissions.

Since I’m following the RESTful pattern, I thought on creating a  
GroupsPermissions (via Group  
has\_many Permissions :through =\> GroupsPermissions in the Group model)  
resource, even thought it doesn’t map to anything concrete (such as  
Friendship or any other relathinship  
between two entities).

My question is: Is it okay to sometimes create these kind of meaningless  
resources so that you are able to CRUD them in a RESTful way, instead of  
creating more actions into the Group and Permissions models? Or is there  
a  
better way to do that I might not be aware of?

Thanks in advance!

Marcelo.

---

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [July 22, 2008, 3:53am UTC](https://www.ruby-forum.com/t/meaningless-rest-resources-for-n-n-relationships/143707/2 "2008-07-22T03:53:08Z")

</div>

Ok, already solved it.

# It happened that it wasn’t a “meaningless” association. Some guys @ #rubyonrails helped me come into a conclusion that Groups vs Permissions

Authorization. Thanks goes to dblack and life @ #rubyonrails.

The rationale behind using Group has\_many Permissions :through =\>  
Authorization is that of clean code and design. Since I’m following the  
RESTful design, I might take advantage of this “controller design  
pattern”  
to reduce code and keep things DRY and simple. Instead of creating  
methods  
to add permissions to manage the group vs permission relationship in the  
Group model, I can just use the AuthorizationsController REST methods.

Thanks,

Marcelo.

On Mon, Jul 21, 2008 at 8:12 PM, Marcelo de Moraes S. \<

---

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [July 22, 2008, 3:53am UTC](https://www.ruby-forum.com/t/meaningless-rest-resources-for-n-n-relationships/143707/3 "2008-07-22T03:53:44Z")

</div>

Ops, I meant lifo not life for the username of the guy who helped me at  
the  
channel. Sorry.

On Mon, Jul 21, 2008 at 10:52 PM, Marcelo de Moraes S. \<
