Commit 34c2d8e82eec046bd73a2ed145210bdc83bbe90e
1 parent
15a72a3b
Exists in
master
and in
4 other branches
authorized_for scope added to project
Showing
2 changed files
with
2 additions
and
1 deletions
Show diff stats
app/models/project.rb
| @@ -73,6 +73,7 @@ class Project < ActiveRecord::Base | @@ -73,6 +73,7 @@ class Project < ActiveRecord::Base | ||
| 73 | scope :public_only, where(private_flag: false) | 73 | scope :public_only, where(private_flag: false) |
| 74 | scope :without_user, ->(user) { where("id NOT IN (:ids)", ids: user.projects.map(&:id) ) } | 74 | scope :without_user, ->(user) { where("id NOT IN (:ids)", ids: user.projects.map(&:id) ) } |
| 75 | scope :not_in_group, ->(group) { where("id NOT IN (:ids)", ids: group.project_ids ) } | 75 | scope :not_in_group, ->(group) { where("id NOT IN (:ids)", ids: group.project_ids ) } |
| 76 | + scope :authorized_for, ->(user) { joins(:users_projects) { where(user_id: user.id) } } | ||
| 76 | 77 | ||
| 77 | class << self | 78 | class << self |
| 78 | def active | 79 | def active |
app/views/dashboard/_groups.html.haml