From aba212e13062c43a1192ef885b05145ac1cc9fe7 Mon Sep 17 00:00:00 2001 From: David Gay Date: Sun, 23 May 2021 17:06:34 -0400 Subject: Bazaar with buy orders, sell orders, and order cancellation --- app/models/bazaar_order.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 app/models/bazaar_order.rb (limited to 'app/models/bazaar_order.rb') diff --git a/app/models/bazaar_order.rb b/app/models/bazaar_order.rb new file mode 100644 index 0000000..d36d520 --- /dev/null +++ b/app/models/bazaar_order.rb @@ -0,0 +1,12 @@ +class BazaarOrder < ApplicationRecord + include DestroyIfZeroQuantity + + belongs_to :character + belongs_to :item + + validates :price_each, :quantity, + numericality: { greater_than_or_equal_to: 0, + less_than_or_equal_to: 2_000_000_000, only_integer: true } + validates :buy_order, inclusion: { in: [true, false] } + +end -- cgit v1.2.3