Commit e13026a3 authored by Alexis Reigel's avatar Alexis Reigel

use more efficient AR length check methods

parent cc4bc22a
...@@ -252,11 +252,11 @@ module Ci ...@@ -252,11 +252,11 @@ module Ci
end end
def either_projects_or_group def either_projects_or_group
if groups.length > 1 if groups.many?
errors.add(:runner, 'can only be assigned to one group') errors.add(:runner, 'can only be assigned to one group')
end end
if groups.length > 0 && projects.length > 0 if group? && project?
errors.add(:runner, 'can only be assigned either to projects or to a group') errors.add(:runner, 'can only be assigned either to projects or to a group')
end end
end end
......
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