I the following three models which all have has_and_belongs_to_many
User <-> UserGroup <-> Permissions
class UserGroup < ActiveRecord::Base
has_and_belongs_to_many :users, :join_table => “user_usergroup_join”
has_and_belongs_to_many :permissions, :join_table =>
“usergroup_permission_join”, :uniq => true
I can do this:
permissions = user.user_groups.find(:first).permissions
permissions = user.user_groups.permissions
I want to get all the user permissions, do I have to loop though each
user group and add the permission from each one by one?
Many thanks in advance!