super-graph/examples/rails-app/app/models/purchase.rb

5 lines
163 B
Ruby

class Purchase < ApplicationRecord
validates :sale_type, :inclusion => { :in => %w{rented bought} }
validates :quantity, numericality: { greater_than: 0 }
end