I’m creating a JSON API for my application. I’d like to use rocket_pants for the JSON API and doorkeeper to provide OAuth2 support.
My problem is that it seems that once I change my controller to extend rocket pants controller the doorkeeper methods are no longer available.
So, as soon as I’m changing the declaration of the controller to class Api::V1::ApiController < RocketPants::Base, I’m getting this error:
in `<class:ApiController>': undefined method `doorkeeper_for' for Api::V1::ApiController:Class (NoMethodError)
It probably makes sense, since rocket pants has no way of knowing about doorkeeper, but I’d like to know what I should do in order to make it recognize doorkeeper.
If you use doorkeeper 0.4.1 or up, you can add the doorkeeper filter to your controller:
Since rocket_pants already includes
AbstractController::Callbacksyou can skip it, so your controller would look like:This page on the wiki also might be useful: https://github.com/applicake/doorkeeper/wiki/ActionController::Metal-with-doorkeeper