Sha256: 2fd9f07c03cb509a62d8ecf52e0b7d3a6ab1f718703dd4482aedaff4f9f8db46

Contents?: true

Size: 638 Bytes

Versions: 4

Compression:

Stored size: 638 Bytes

Contents

module Sis
  module Core
    class IdentificationPattern < ApplicationRecord
      belongs_to :programme_level
      belongs_to :programme_type
      belongs_to :programme

      validates :id_pattern, presence: true
      validates :id_pattern, uniqueness: true

      validates :programme_id, uniqueness: { scope: %i[programme_level_id programme_type_id],
                                             message: 'This combination is already taken !' }

      delegate(:name, to: :programme, prefix: true)
      delegate(:name, to: :programme_level, prefix: true)
      delegate(:name, to: :programme_type, prefix: true)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sis_core-1.0.20 app/models/sis/core/identification_pattern.rb
sis_core-1.0.19 app/models/sis/core/identification_pattern.rb
sis_core-1.0.18 app/models/sis/core/identification_pattern.rb
sis_core-1.0.17 app/models/sis/core/identification_pattern.rb