Files
nairobi/app/models/proposal_executed_dashboard_action.rb
Juan Salvador Pérez García 8bb3d5b3ab frozen_string_literal removed
frozen_string_literal magic comment has been removed until a decission
is taken regarding to its convenience.
2018-07-17 17:53:18 +02:00

16 lines
561 B
Ruby

class ProposalExecutedDashboardAction < ActiveRecord::Base
belongs_to :proposal
belongs_to :proposal_dashboard_action
has_many :administrator_tasks, as: :source, dependent: :destroy
validates :proposal, presence: true, uniqueness: { scope: :proposal_dashboard_action }
validates :proposal_dashboard_action, presence: true
validates :executed_at, presence: true
validates :comments, presence: true, allow_blank: false, if: :comments_required?
def comments_required?
proposal_dashboard_action&.request_to_administrators? || false
end
end