Sha256: b3b9a7b6e47c527cd67273e204497f4fbe4449c573233abedab62c698d04d8cd
Contents?: true
Size: 968 Bytes
Versions: 7
Compression:
Stored size: 968 Bytes
Contents
module Comee module Core class BackOrder < ApplicationRecord enum :status, {draft: 0, submitted: 1, confirmed: 2} after_create_commit :notify_supplier belongs_to :supplier has_many :back_order_items has_noticed_notifications model_name: "Comee::Core::Notification" validates :order_number, presence: true, uniqueness: true validates :order_date, :delivery_date, :terms, :delivery_address, :invoice_address, :status, presence: true delegate(:name, to: :supplier, prefix: true) def self.ransackable_attributes(auth_object = nil) ["delivery_address", "delivery_date", "invoice_address", "order_date", "order_number", "status", "supplier_id"] end def self.ransackable_associations(auth_object = nil) [] end private def notify_supplier Comee::Core::NewOrderNotification.with(back_order: self).deliver_later(supplier.user) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems