Module: Rubix::Associations::HasManyUserGroups

Included in:
User
Defined in:
lib/rubix/associations/has_many_user_groups.rb

Instance Method Summary collapse

Instance Method Details

#user_group_idsObject



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

def user_group_ids
  return @user_group_ids if @user_group_ids
  return unless @user_groups
  @user_group_ids = @user_groups.map(&:id)
end

#user_group_ids=(ugids) ⇒ Object



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

def user_group_ids= ugids
  return unless ugids
  @user_group_ids = ugids
end

#user_groupsObject



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

def user_groups
  return @user_groups if @user_groups
  return unless @user_group_ids
  @user_groups = @user_group_ids.map { |ugid| UserGroup.find(:id => ugid) }
end

#user_groups=(ugs) ⇒ Object



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

def user_groups= ugs
  return unless ugs
  @user_groups    = ugs
  @user_group_ids = ugs.map(&:id)
end