have policy_scope always use scope.all or something else to ensure it's an ActiveRecord relation

This commit is contained in:
Devin Howard 2016-06-28 14:49:46 +08:00
parent b72536853f
commit 6c22ebcc51
2 changed files with 2 additions and 2 deletions

View file

@ -55,7 +55,7 @@ class ApplicationPolicy
end
def resolve
scope
scope.all
end
end
end

View file

@ -4,7 +4,7 @@ class TokenPolicy < ApplicationPolicy
if user
scope.where('tokens.user_id = ?', user.id)
else
where(:id => nil).where("id IS NOT ?", nil) # to just return none
scope.where(:id => nil).where("id IS NOT ?", nil) # to just return none
end
end
end