On 15 March 2010 11:14, eugenio <[email protected]> wrote:
> a "User" has_and_belongs_to_many "Roles"
> a "Role" has_and_belongs_to_many "Rights"
>
> how can i relate Users and Rights? i would like something like
> @user.rights
> i know it can be done via SQL, but i don't know if there is a more
> rails-way to do this.

What do you mean by how to relate them?  As you have defined it then
if you have a user, @user, then @user.roles will give you an array of
roles and @user.role[0].rights will give you an array of rights for
that role.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to