diff options
| author | Andrey Kumanyaev <me@zzet.org> | 2013-04-03 07:06:18 +0400 |
|---|---|---|
| committer | Andrey Kumanyaev <me@zzet.org> | 2013-04-03 07:06:18 +0400 |
| commit | 85e039049cba5ac1bf92e6cbba2ea1236d6892f7 (patch) | |
| tree | b6705acaee7c44c209e00857030f8c97458c9395 /app | |
| parent | 734d6fcdf00846364fa39fc374753b7ea2cef603 (diff) | |
| download | gitlab-ce-85e039049cba5ac1bf92e6cbba2ea1236d6892f7.tar.gz | |
Fix tests
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/project.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 463829229b5..09fdc07fb25 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -86,13 +86,13 @@ class Project < ActiveRecord::Base validate :check_limit, :repo_name # Scopes - scope :without_user, ->(user) { where("id NOT IN (:ids)", ids: user.authorized_projects.map(&:id) ) } - scope :without_team, ->(team) { team.projects.present? ? where("id NOT IN (:ids)", ids: team.projects.map(&:id)) : scoped } - scope :not_in_group, ->(group) { where("id NOT IN (:ids)", ids: group.project_ids ) } - scope :in_team, ->(team) { where("id IN (:ids)", ids: team.projects.map(&:id)) } + scope :without_user, ->(user) { where("projects.id NOT IN (:ids)", ids: user.authorized_projects.map(&:id) ) } + scope :without_team, ->(team) { team.projects.present? ? where("projects.id NOT IN (:ids)", ids: team.projects.map(&:id)) : scoped } + scope :not_in_group, ->(group) { where("projects.id NOT IN (:ids)", ids: group.project_ids ) } + scope :in_team, ->(team) { where("projects.id IN (:ids)", ids: team.projects.map(&:id)) } scope :in_namespace, ->(namespace) { where(namespace_id: namespace.id) } scope :in_group_namespace, -> { joins(:group) } - scope :sorted_by_activity, -> { order("last_activity_at DESC") } + scope :sorted_by_activity, -> { order("projects.last_activity_at DESC") } scope :personal, ->(user) { where(namespace_id: user.namespace_id) } scope :joined, ->(user) { where("namespace_id != ?", user.namespace_id) } scope :public_only, -> { where(public: true) } @@ -190,7 +190,7 @@ class Project < ActiveRecord::Base end def last_activity_date - last_activity_at + last_activity_at || updated_at end def project_id |
