This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
has_many :members, :through => :memberships, :source => :user, :include => { :memberships => :role }, :order => 'roles.rank' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Membership < ActiveRecord::Base | |
# attr_accessible :title, :body | |
set_primary_keys :user_id, :group_id | |
belongs_to :user | |
belongs_to :group | |
# Weird that we have to say "belongs_to", but it works. | |
belongs_to :role |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scope :roles_in_group, lambda { |g| { :conditions => { :roles => {:memberships => {:group => g.ancestors}}}}} |
NewerOlder