class ApplicationPolicy::Scope
Public Instance Methods
anon_user_scope()
click to toggle source
# File lib/generators/natural/install/templates/application_policy.rb, line 19 def anon_user_scope scope # scope.public # e.g. only display public data end
resolve()
click to toggle source
It is recommended to use per-role scopes for Users # simply extend the resolve method with conditions for each “role” and the name of the scope they should call.
# File lib/generators/natural/install/templates/application_policy.rb, line 6 def resolve if !user.is_a? User anon_user_scope else standard_user_scope end end
standard_user_scope()
click to toggle source
# File lib/generators/natural/install/templates/application_policy.rb, line 14 def standard_user_scope scope # scope.where(user: user) # e.g. only show resources that belong to that user end