subtract debits from cake balance
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
|
||||
default_scope { order(created_at: :desc) }
|
||||
end
|
||||
|
||||
@@ -33,6 +33,9 @@ class StakeOrder < ApplicationRecord
|
||||
super & ["pool_name", "amount"]
|
||||
end
|
||||
|
||||
scope :add, -> { where("amount > 0") }
|
||||
scope :remove, -> { where("amount < 0") }
|
||||
|
||||
private
|
||||
|
||||
def notification_message
|
||||
|
||||
@@ -29,6 +29,7 @@ class User < ApplicationRecord
|
||||
|
||||
has_many :documents, class_name: "UserDocument", dependent: :destroy
|
||||
has_many :stake_orders, dependent: :restrict_with_error
|
||||
has_many :sell_crypto_orders, dependent: :restrict_with_error
|
||||
has_one :fiat_balance, dependent: :restrict_with_error
|
||||
|
||||
validates :first_name, :last_name, :email, presence: true
|
||||
|
||||
Reference in New Issue
Block a user