Skip to content

Instantly share code, notes, and snippets.

@radar
Created July 8, 2009 23:39
Show Gist options
  • Save radar/143301 to your computer and use it in GitHub Desktop.
Save radar/143301 to your computer and use it in GitHub Desktop.
class Entity < ActiveRecord::Base
belongs_to :client
has_many :group_members, :class_name => "Member", :foreign_key => "group_id"
has_many :users, :through => :group_members, :source => :entity
alias_method :orig_users, :users
def users
entity.everyone_group? ? orig_users : client.users
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment