Sha256: 6503aa9b01f138afa7c926a0faea6c73d70cd8e1f84a3ce8edafebb5f0845ee4
Contents?: true
Size: 989 Bytes
Versions: 10
Compression:
Stored size: 989 Bytes
Contents
# A set of Participants. class Group < ActiveRecord::Base belongs_to :arm belongs_to :creator, class_name: "User" has_many :memberships, dependent: :destroy has_many :participants, through: :memberships has_many :active_memberships, -> { active }, class_name: "Membership", foreign_key: :group_id, dependent: :destroy, inverse_of: :active_group has_many :tasks, dependent: :destroy has_many :active_participants, through: :active_memberships validates :arm_id, presence: true validates :title, presence: true, length: { maximum: 50 }, uniqueness: true delegate :count, to: :memberships, prefix: true def learning_tasks tasks .joins(:bit_core_content_module) .where( BitCore::ContentModule.arel_table[:type] .eq("ContentModules::LessonModule") ) end def non_moderator_memberships memberships.joins(:participant) .merge(Participant.not_moderator) end end
Version data entries
10 entries across 10 versions & 1 rubygems