summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-25 16:36:14 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-25 16:36:14 +0200
commit74e329064abc1306132dd73dcb2e25221379f568 (patch)
treec36c8646c1f90c031732f7279528a41440c0667e /app/models
parent1c88fbb3915e6d2efcac5cc2edb8d480f1112c75 (diff)
downloadgitlab-ce-74e329064abc1306132dd73dcb2e25221379f568.tar.gz
teams refactoring and cleanup pt.1
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index ba46fea2864..e521dfc93da 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -80,7 +80,7 @@ class Project < ActiveRecord::Base
# Scopes
scope :without_user, ->(user) { where("id NOT IN (:ids)", ids: user.authorized_projects.map(&:id) ) }
scope :not_in_group, ->(group) { where("id NOT IN (:ids)", ids: group.project_ids ) }
- scope :without_team, ->(team) { where("id NOT IN (:ids)", ids: team.projects.map(&:id)) }
+ scope :without_team, ->(team) { team.projects.present? ? where("id NOT IN (:ids)", ids: team.projects.map(&:id)) : scoped }
scope :in_team, ->(team) { where("id IN (:ids)", ids: team.projects.map(&:id)) }
scope :in_namespace, ->(namespace) { where(namespace_id: namespace.id) }
scope :sorted_by_activity, ->() { order("(SELECT max(events.created_at) FROM events WHERE events.project_id = projects.id) DESC") }