Module: Grape::CanCan::Endpoint

Defined in:
lib/grape/cancan.rb

Instance Method Summary collapse

Instance Method Details

#authorize_route!Object

Call authorize using the :authorize key on the route



23
24
25
26
# 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_abilityObject

Returns an instance of the CanCan ability



17
18
19
# File 'lib/grape/cancan.rb', line 17

def current_ability
  @current_ability ||= ::Ability.new(current_user)
end