lib/grape/cancan.rb in grape-cancan-0.0.2 vs lib/grape/cancan.rb in grape-cancan-0.0.3
- old
+ new
@@ -1,7 +1,9 @@
require 'grape'
require 'grape/cancan/version'
+require 'active_support/inflector'
+require 'active_support/core_ext/module/delegation'
module Grape
module CanCan
module API
# Convienience method to authorize every route
@@ -21,10 +23,10 @@
def authorize_route!
opts = env['api.endpoint'].options[:route_options]
authorize!(*opts[:authorize]) if opts.key?(:authorize)
end
end
-
- Grape::API.extend Grape::CanCan::API
- Grape::Endpoint.send :include, Grape::CanCan::Endpoint
end
end
+
+Grape::API::Instance.extend Grape::CanCan::API
+Grape::Endpoint.send :include, Grape::CanCan::Endpoint