Sha256: 326548a72459e7d0b5e8fafcb9b6e73a25a9f0e76c6d026d1949ae2381e4aef9
Contents?: true
Size: 986 Bytes
Versions: 35
Compression:
Stored size: 986 Bytes
Contents
module Comee module Core class QuotationRequest < ApplicationRecord before_validation :set_reference_no, if: proc { |rfq| rfq.reference_no.nil? } belongs_to :client belongs_to :delivery_address, -> { where(address_type: ClientAddress::DELIVERY_ADDRESS) }, class_name: "Comee::Core::ClientAddress" belongs_to :invoice_address, -> { where(address_type: ClientAddress::INVOICING_ADDRESS) }, class_name: "Comee::Core::ClientAddress" has_many :quotation_request_items enum :status, {draft: 0, submitted: 1, awaiting_confirmation: 2, confirmed: 3, converted: 4} validates :status, presence: true def self.ransackable_attributes(_auth_object = nil) %w[id client_id reference_no status] end private def set_reference_no stamp = DateTime.now.to_i self.reference_no = "RFQ-#{client.code}-#{stamp}" end end end end
Version data entries
35 entries across 35 versions & 1 rubygems