FilteringService works with scope :all event if current user is not defined

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2014-01-16 11:40:33 +02:00
parent a77dfc464b
commit 974281d140
No known key found for this signature in database
GPG Key ID: 627C5F589F467F17
1 changed files with 5 additions and 1 deletions

View File

@ -44,7 +44,11 @@ class FilteringService
when 'created-by-me', 'authored' then
current_user.send(table_name)
when 'all' then
klass.of_projects(current_user.authorized_projects.pluck(:id))
if current_user
klass.of_projects(current_user.authorized_projects.pluck(:id))
else
klass.of_projects(Project.public_only)
end
when 'assigned-to-me' then
current_user.send("assigned_#{table_name}")
else