Sha256: 1a4f7d71ad3904710bb9104f4b6a8e17fa9a912b9220bc0635354a85aa76ae47

Contents?: true

Size: 790 Bytes

Versions: 3

Compression:

Stored size: 790 Bytes

Contents

# Order 是订单。

class Unidom::Order::Order < Unidom::Order::ApplicationRecord

  self.table_name = 'unidom_orders'

  include Unidom::Common::Concerns::ModelExtension
  include Unidom::Order::Concerns::AsAdjusted

  validates :number,           presence: true, length:       { is: self.columns_hash['number'].limit  }
  validates :purchase_amount,  presence: true, numericality: { less_than: 1000000000, greater_than: 0 }
  validates :aggregate_amount, presence: true, numericality: { less_than: 1000000000, greater_than: 0 }

  belongs_to :placer, polymorphic: true
  belongs_to :taker,  polymorphic: true

  has_many :items, class_name: 'Unidom::Order::OrderItem'

  scope :placed_by, ->(placer) { where placer: placer }
  scope :taken_by,  ->(taker)  { where taker:  taker  }

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
unidom-order-1.3.3 app/models/unidom/order/order.rb
unidom-order-1.3.2 app/models/unidom/order/order.rb
unidom-order-1.3.1 app/models/unidom/order/order.rb