module DeadSimpleAuthorization::Helpers
Private Instance Methods
can?(user, action, resource)
click to toggle source
Check if a user can perform an action for a specific resource. This method is not as strict as authorize in a sense that it does not raise an error, but returns the boolean outcome of the check
# File lib/dead_simple_authorization/helpers.rb, line 26 def can?(user, action, resource) action = action.to_s policy_class = "#{resource.class}Policy" policy = Object::const_get(policy_class).new(resource, user) policy.send("#{action}?") end