negos_app/app/models/offer.rb
2016-02-16 21:09:48 +01:00

14 lines
334 B
Ruby
Executable File

class Offer < ActiveRecord::Base
acts_as_paranoid
belongs_to :need
has_many :accepted_offers, dependent: :destroy
has_many :customers, through: :accepted_offers
validates :supplier, :presence => true, length: {within: 1..128}
validates :price,
:presence => true,
numericality: {greater_than_or_equal_to: 0}
end