OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/app/models/principal_role.rb

18 lines
400 B

class PrincipalRole < ActiveRecord::Base
belongs_to :principal
belongs_to :role
validate :validate_assignable
attr_accessible :principal,
:role
def validate_assignable
add_error_can_not_be_assigned unless self.role.assignable_to?(self.principal)
end
private
def add_error_can_not_be_assigned
self.errors[:base] << l(:error_can_not_be_assigned)
end
end