Sha256: 41d12596731d02f16b50f08452ac2a13053b2c06ca3ad88744e4f51501423467

Contents?: true

Size: 573 Bytes

Versions: 2

Compression:

Stored size: 573 Bytes

Contents

require 'subj_models/concerns/comprising_external_id'

module SubjModels

  module NomenclatureVariety

    def self.included(including_class)

      including_class.class_eval do

        include SubjModels::ComprisingExternalId

        belongs_to :nomenclature

        has_many :nomenclature_prices
        has_many :order_items

        validates :name, presence: true

        scope :external_id, -> id { where(external_id: id) }
        scope :nomenclature_id, -> (nomenclature_id) { parent_id_scope("nomenclature", nomenclature_id) }

      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
subj_models-0.4.1 lib/subj_models/nomenclature_variety.rb
subj_models-0.4 lib/subj_models/nomenclature_variety.rb