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