diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/users_project.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/users_project.rb b/app/models/users_project.rb index bdc10633a3e..96e2d16aff0 100644 --- a/app/models/users_project.rb +++ b/app/models/users_project.rb @@ -9,7 +9,8 @@ class UsersProject < ActiveRecord::Base validates_uniqueness_of :user_id, :scope => [:project_id] validates_presence_of :user_id validates_presence_of :project_id - + validate :user_has_a_role_selected + delegate :name, :email, :to => :user, :prefix => true def update_gitosis_project @@ -18,6 +19,10 @@ class UsersProject < ActiveRecord::Base end end + def user_has_a_role_selected + errors.add(:base, "Please choose at least one Role in the Access list") unless read || write || admin + end + end # == Schema Information # |