Sha256: ea430b9263ee1ecaaf95173e80ba2ac0e7b4c1e9955a0a056cbb76630ebade93

Contents?: true

Size: 529 Bytes

Versions: 10

Compression:

Stored size: 529 Bytes

Contents

module Gaku
  class SemesterClassGroup < ActiveRecord::Base

    belongs_to :semester
    belongs_to :class_group

    validates :class_group_id, presence: true

    validates :semester_id,
              presence: true,
              uniqueness: {
                            scope: :class_group_id,
                            message: I18n.t(:'semester_class_group.uniqueness')
                          }

    def self.group_by_semester
      all.includes([:semester, :class_group]).group_by(&:semester_id)
    end

  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
gaku-0.1.1 core/app/models/gaku/semester_class_group.rb
gaku_core-0.1.1 app/models/gaku/semester_class_group.rb
gaku-0.1.0 core/app/models/gaku/semester_class_group.rb
gaku_core-0.1.0 app/models/gaku/semester_class_group.rb
gaku_core-0.0.3 app/models/gaku/semester_class_group.rb
gaku-0.0.3 core/app/models/gaku/semester_class_group.rb
gaku-0.0.2 core/app/models/gaku/semester_class_group.rb
gaku_core-0.0.2 app/models/gaku/semester_class_group.rb
gaku-0.0.1 core/app/models/gaku/semester_class_group.rb
gaku_core-0.0.1 app/models/gaku/semester_class_group.rb