module Grape::CanCan::Endpoint

Public Instance Methods

authorize_route!() click to toggle source

Call authorize using the :authorize key on the route

# File lib/grape/cancan.rb, line 23
def authorize_route!
  opts = env['api.endpoint'].options[:route_options]
  authorize!(*opts[:authorize]) if opts.key?(:authorize)
end
current_ability() click to toggle source

Returns an instance of the CanCan ability

# File lib/grape/cancan.rb, line 17
def current_ability
  @current_ability ||= ::Ability.new(current_user)
end