module Logistics module Core class AgencyPermitDocument < ApplicationRecord belongs_to :agency belongs_to :document_type validates :agency_id, :document_type_id, presence: true, allow_blank: false validates :agency_id, :uniqueness => {:scope => [:document_type_id]} delegate(:code, to: :document_type, prefix: false) delegate(:name, to: :document_type, prefix: false) delegate(:description, to: :document_type, prefix: false) delegate(:document_type_category_id, to: :document_type, prefix: false) delegate(:document_type_category_name, to: :document_type, prefix: false) delegate(:document_type_origin_id, to: :document_type, prefix: false) delegate(:document_type_origin_name, to: :document_type, prefix: false) end end end