I have an app where “users” can belong in “groups” with certain “roles”
(eg. a user can own a group).
Normally I’d make users has_and_belongs_to_many groups and put a role_id
on the join table. But - a role is really a first class citizen also, so
a model is in order.
The problem with making a “role” model which has_many “users” and
“groups”, is that it blurs the user/group relation which is also a first
class citizen.
A concrete need is, that I need to be able to look up “items” which have
been assigned to a “user”, or a “group” in which the user has the role
owner.
How can I support this need and have a “role” model also?
Just FYI,
I am doing exactly what you are trying to do with Edge rails but this
newest
release candidate is bombing for me for some reason. I opened a ticket
for
it, and will continue to look for a solution. It is entirely possible
that
it is a syntax error on my part,but it was working for me in the
previous
edge version of rails: