Commit 7b335893 authored by Adam Leonard's avatar Adam Leonard Committed by Dmitriy Zaporozhets

Add check to ensure that a team member has atleast one Access Role selected

parent 565ec8a1
......@@ -9,6 +9,7 @@ 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
......@@ -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
#
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment