class Group

Schema Information

Table name: groups

id            :integer          not null, primary key
name          :string(255)
description   :text
university_id    :integer
resource_id   :integer
resource_type :string(255)

Public Instance Methods

automated_group?() click to toggle source

Returns true if resource type is not user

# File app/models/group.rb, line 52
def automated_group?
  !user_group?
end
tutorable?() click to toggle source

Returns true if resource type is course

# File app/models/group.rb, line 66
def tutorable?
  resource_type == 'Course'
end
tutors() click to toggle source

Returns tutors

Calls superclass method
# File app/models/group.rb, line 57
def tutors
  if tutorable?
    resource.tutors
  else
    super
  end
end
trigger_pusher_group_event() click to toggle source

Trigger background job to create/update groups

# File app/models/group.rb, line 71
def trigger_pusher_group_event
  CreateOrUpdateGroups.perform_async(id)
end
user_group?() click to toggle source

Returns true if resource type is user

# File app/models/group.rb, line 47
def user_group?
  resource_type == 'User'
end
user_ids=(ids) click to toggle source

Convert comma separated user ids string into array format.

Calls superclass method
# File app/models/group.rb, line 41
def user_ids=(ids)
  ids = ids.split(',') if ids.is_a? String
  super(ids)
end