Last Updated: September 09, 2019
·
3.047K
· igama

rails-api and Devise

The 'rails-api' gem is a "Rails for API only applications". It does not have all the Rails modules enabled, this way it's simpler. However, this is a issue when you try to use the Devise gem with it:

devise-2.2.3/app/controllers/devise_controller.rb:13:in `<class:DeviseController>': undefined local variable or method `mimes_for_respond_to' for DeviseController:Class

The solution for this is quite simple, add to your application controller the following module

class ApplicationController < ActionController::API
  include ActionController::MimeResponds
end

Have fun

1 Response
Add your response

Nice!

over 1 year ago ·