Sha256: 599c92ce9b09d12c85c9df72598e76cbc81d8bef3698c82da9d56634d6489561

Contents?: true

Size: 730 Bytes

Versions: 7

Compression:

Stored size: 730 Bytes

Contents

module Logistics
  module Core
    class OperationDocument < ApplicationRecord
      mount_base64_uploader :file, DocumentUploader
      belongs_to :operation
      belongs_to :user, class_name: 'Mks::Auth::User', optional: true
      belongs_to :acceptor, class_name: 'Mks::Auth::User', optional: true

      scope :accepted, -> { where(:accepted => true) }
      scope :remaining, -> { where(:accepted => false) }

      validates :document, :original, :copy, :certified, :operation, presence: true

      def user_name
        self.user&.first_name.to_s + ' ' + self.user&.last_name.to_s
      end

      def acceptor_name
        self.acceptor&.first_name.to_s + ' ' + self.acceptor&.last_name.to_s
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
logistics_core-21.11.2 app/models/logistics/core/operation_document.rb
logistics_core-21.11.1 app/models/logistics/core/operation_document.rb
logistics_core-21.08.1 app/models/logistics/core/operation_document.rb
logistics_core-21.03.1 app/models/logistics/core/operation_document.rb
logistics_core-20.10.3 app/models/logistics/core/operation_document.rb
logistics_core-20.10.2 app/models/logistics/core/operation_document.rb
logistics_core-20.10.1 app/models/logistics/core/operation_document.rb