Sha256: 04a254d385f2c40407ad362fbe037096a886bcede4cfc566569731f9529bcf4f
Contents?: true
Size: 933 Bytes
Versions: 19
Compression:
Stored size: 933 Bytes
Contents
require 'subj_models/concerns/comprising_external_id' module SubjModels module NomenclaturePriceModule def self.included(including_class) including_class.class_eval do include SubjModels::ComprisingExternalId belongs_to :nomenclature, touch: true belongs_to :nomenclature_variety belongs_to :price_type belongs_to :quality belongs_to :measure_unit belongs_to :event has_many :order_items validates :current_price, presence: true scope :nomenclature_id, -> (nomenclature_id) { parent_id_scope("nomenclature", nomenclature_id) } scope :belongs_to_nomenclature, -> (nomenclature_id) do where(nomenclature_id: nomenclature_id).union(joins(:nomenclature_variety).where("nomenclature_varieties.nomenclature_id" => nomenclature_id)) end end end def to_s id.to_s # TODO end end end
Version data entries
19 entries across 19 versions & 1 rubygems