Meaningless REST resources for n:n relationships

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.

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.

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