23 lines
610 B
Ruby
23 lines
610 B
Ruby
# Copyright (C) 2024 Manuel Bustillo
|
|
|
|
# == Schema Information
|
|
#
|
|
# Table name: expenses
|
|
#
|
|
# id :uuid not null, primary key
|
|
# amount :decimal(, )
|
|
# name :string
|
|
# pricing_type :enum default("fixed"), not null
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
class Expense < ApplicationRecord
|
|
enum :pricing_type,
|
|
fixed: 'fixed',
|
|
per_person: 'per_person'
|
|
|
|
validates :name, presence: true
|
|
validates :amount, presence: true, numericality: { greater_than: 0 }
|
|
validates :pricing_type, presence: true
|
|
end
|