|
class MissionAgent < ActiveRecord::Base
extend FriendlyId
friendly_id :role, use: :slugged
validates_presence_of :role, :slug
belongs_to :mission
belongs_to :user
has_many :agent_steps, :dependent => :destroy
has_many :mission_candidates, :dependent => :destroy
accepts_nested_attributes_for :agent_steps, allow_destroy:true
accepts_nested_attributes_for :mission_candidates
def is_assigned
if self.mission_candidates.find_all_by_status(1).last == nil
return false
else
return true
end
end
end
|