Sha256: fa39632d0dd6b71b09eac936e4e8f1b880ba7a9f71410a66e8642a501bb88853

Contents?: true

Size: 555 Bytes

Versions: 3

Compression:

Stored size: 555 Bytes

Contents

module Unidom::ArticleNumber::Concerns::AsMarked

  extend ActiveSupport::Concern

  self.included do |includer|

    has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :marked

    def is_marked!(as: nil, by: nil, at: Time.now)
      raise ArgumentError.new('The as argument is required.') if as.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! barcode: as, marker: by, opened_at: at
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
unidom-article_number-1.3 app/models/unidom/article_number/concerns/as_marked.rb
unidom-article_number-1.2.1 app/models/unidom/article_number/concerns/as_marked.rb
unidom-article_number-1.2 app/models/unidom/article_number/concerns/as_marked.rb