negos_app/app/models/offer.rb
2017-05-18 01:21:04 +02:00

15 lines
413 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}
has_many :offer_reseauxes
has_many :reseauxes, :through => :offer_reseauxes
end