I believe this fixes the error connor brought up

This commit is contained in:
Devin Howard 2016-04-22 14:00:35 +08:00
parent c7402c3ee5
commit b2da15245a

View file

@ -4,7 +4,7 @@ class MapPolicy < ApplicationPolicy
visible = ['public', 'commons']
permission = 'maps.permission IN (?)'
if user
shared_maps = user.user_maps.map(&:id)
shared_maps = user.shared_maps.map(&:id)
scope.where(permission + ' OR maps.id IN (?) OR maps.user_id = ?', visible, shared_maps, user.id)
else
scope.where(permission, visible)