Files
nairobi/app/models/valuator.rb
2016-04-27 16:27:26 +02:00

18 lines
461 B
Ruby

class Valuator < ActiveRecord::Base
belongs_to :user, touch: true
delegate :name, :email, :name_and_email, to: :user
has_many :valuation_assignments, dependent: :destroy
has_many :spending_proposals, through: :valuation_assignments
validates :user_id, presence: true, uniqueness: true
def description_or_email
description.present? ? description : email
end
def description_or_name
description.present? ? description : name
end
end