class Earning < ApplicationRecord # === Relations === belongs_to :event belongs_to :user belongs_to :order # === Enums === enum :status, { pending: 0, paid: 1 } # === Validations === validates :amount_cents, presence: true, numericality: { greater_than_or_equal_to: 0 } validates :fee_cents, presence: true, numericality: { greater_than_or_equal_to: 0 } validates :net_amount_cents, numericality: { greater_than_or_equal_to: 0, allow_nil: true } validates :status, presence: true validates :stripe_payout_id, allow_blank: true, uniqueness: true end