Sha256: ffda921b1554075429502e47be9ad372b6cf6f7f7b54de8e8d109b9f0bf12bdd

Contents?: true

Size: 689 Bytes

Versions: 3

Compression:

Stored size: 689 Bytes

Contents

module Comee
  module Core
    class ClientOrder < ApplicationRecord
      belongs_to :client
      has_many :client_order_items

      enum :status, {draft: 0, confirmed: 1}

      validates :order_number, presence: true, uniqueness: true
      validates :order_date, :delivery_date, :terms, :delivery_address, :invoice_address, :status, presence: true

      delegate(:name, to: :client, prefix: true)

      def self.ransackable_attributes(auth_object = nil)
        ["delivery_address", "delivery_date", "invoice_address", "order_date", "order_number", "status", "client_id"]
      end

      def self.ransackable_associations(auth_object = nil)
        []
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
comee_core-0.1.12 app/models/comee/core/client_order.rb
comee_core-0.1.11 app/models/comee/core/client_order.rb
comee_core-0.1.10 app/models/comee/core/client_order.rb