Module: Rubix::Associations::HasManyUsers

Included in:
UserGroup
Defined in:
lib/rubix/associations/has_many_users.rb

Instance Method Summary collapse

Instance Method Details

#user_idsObject



22
23
24
25
26
# File 'lib/rubix/associations/has_many_users.rb', line 22

def user_ids
  return @user_ids if @user_ids
  return unless @users
  @user_ids = @users.map(&:id)
end

#user_ids=(uids) ⇒ Object



17
18
19
20
# File 'lib/rubix/associations/has_many_users.rb', line 17

def user_ids= uids
  return unless uids
  @user_ids = uids
end

#usersObject



11
12
13
14
15
# File 'lib/rubix/associations/has_many_users.rb', line 11

def users
  return @users if @users
  return unless @user_ids
  @users = @user_ids.map { |uid| User.find(:id => uid) }
end

#users=(us) ⇒ Object



5
6
7
8
9
# File 'lib/rubix/associations/has_many_users.rb', line 5

def users= us
  return unless us
  @users    = us
  @user_ids = us.map(&:id)
end