summaryrefslogtreecommitdiff
path: root/app/models/bazaar_order.rb
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-05-23 17:06:34 -0400
committerDavid Gay <david@davidgay.org>2021-05-23 17:06:34 -0400
commitaba212e13062c43a1192ef885b05145ac1cc9fe7 (patch)
tree61e3850ec0c86913a7e2d42076bcd73aa59f480a /app/models/bazaar_order.rb
parent44facc2e567eb3c045ce082428f42276e45b0202 (diff)
Bazaar with buy orders, sell orders, and order cancellation
Diffstat (limited to 'app/models/bazaar_order.rb')
-rw-r--r--app/models/bazaar_order.rb12
1 files changed, 12 insertions, 0 deletions
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