Sha256: 2a41678cf04d9b4692114ba34122d0e613f2728495e59c1bf251c3f885bc6bcf

Contents?: true

Size: 937 Bytes

Versions: 4

Compression:

Stored size: 937 Bytes

Contents

require 'subj_models/services/values_checker'
require 'subj_models/services/types_support'
require 'subj_models/concerns/comprising_external_id'

module SubjModels

  module EventSchedule

    include SubjModels::TypesSupport::EventTypes
    include SubjModels::ValuesChecker

    def self.included(including_class)

      including_class.class_eval do

        include SubjModels::ComprisingExternalId

        enum event_type: EVENT_TYPES

        #belongs_to :event
        #belongs_to :city
        #belongs_to :office

        #has_many :order_items

        validates :event_type, presence: true, inclusion: { in: event_types.keys }
        validates :event_date, :event_price, :title, presence: true

        scope :event_id, -> (event_id) { parent_id_scope("event", event_id) }

      end

    end

    def to_s
      id.to_s # TODO
    end

    def event_type=(value)
      super(check_string_for_int(value))
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
subj_models-0.3.8 lib/subj_models/event_schedule.rb
subj_models-0.3.7 lib/subj_models/event_schedule.rb
subj_models-0.3.6 lib/subj_models/event_schedule.rb
subj_models-0.3.5 lib/subj_models/event_schedule.rb