have policy_scope always use scope.all or something else to ensure it's an ActiveRecord relation
This commit is contained in:
parent
b72536853f
commit
6c22ebcc51
2 changed files with 2 additions and 2 deletions
|
@ -55,7 +55,7 @@ class ApplicationPolicy
|
||||||
end
|
end
|
||||||
|
|
||||||
def resolve
|
def resolve
|
||||||
scope
|
scope.all
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ class TokenPolicy < ApplicationPolicy
|
||||||
if user
|
if user
|
||||||
scope.where('tokens.user_id = ?', user.id)
|
scope.where('tokens.user_id = ?', user.id)
|
||||||
else
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue