You can also create a table associated with Tri that has an entry for each user membership and save that user role.
class Trirelation
belongs_to :group
belongs_to :user
belongs_to :role
end
class User
has_many :trirelations
has_many :groups, through: :trirelations
end
class Group
has_many :trirelations
has_many :users, through: :trirelations
end
class Role
has_many :trirelations
end
, ,
@role = Trirelation.find_by(user_id: 1, group_id: 21).role.name