Sha256: b76422607a2ec1a0d491ffbdaf92bd22d463af8019fd399f45dba66e70864a0e
Contents?: true
Size: 715 Bytes
Versions: 3
Compression:
Stored size: 715 Bytes
Contents
module Unidom::ArticleNumber::Concerns::AsBarcode extend ActiveSupport::Concern self.included do |includer| has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :barcode has_many :marked_products, through: :markings, source: :marked, source_type: 'Unidom::Product::Product' def mark!(marked, by: nil, at: Time.now) raise ArgumentError.new('The marked argument is required.') if marked.blank? raise ArgumentError.new('The by argument is required.' ) if by.blank? raise ArgumentError.new('The at argument is required.' ) if at.blank? markings.create! marked: marked, marker: by, opened_at: at end end end
Version data entries
3 entries across 3 versions & 1 rubygems