Sha256: 900f11c7b7140884b2e506d9ed78c1183d90204d928e85743ac2c875ba552994
Contents?: true
Size: 869 Bytes
Versions: 2
Compression:
Stored size: 869 Bytes
Contents
require 'subj_models/concerns/comprising_external_id' module SubjModels module NomenclaturePrice def self.included(including_class) including_class.class_eval do include SubjModels::ComprisingExternalId belongs_to :nomenclature, touch: true belongs_to :nomenclature_variety belongs_to :quality belongs_to :measure_unit 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
subj_models-0.4.1 | lib/subj_models/nomenclature_price.rb |
subj_models-0.4 | lib/subj_models/nomenclature_price.rb |