I am trying to send a POST request (using Postman) to sign up a new user using devise token auth and I am overriding the registrations controller to enable my own JSON responses.
I keep getting a routing error:
"status": 404,
"error": "Not Found",
"exception": "#<ActionController::RoutingError: uninitialized constant Overrides>"
Here is my registrations controller:
module Api
module V1
module Overrides
class RegistrationsController < DeviseTokenAuth::RegistrationsController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
warden.custom_failure!
render :json=> user.errors, :status=>422
end
end
end
end
end
end
Here is my routes file:
Rails.application.routes.draw do
namespace :api do
scope :v1 do
mount_devise_token_auth_for 'User', at: 'auth', controllers: {
registrations: 'overrides/registrations',
sessions: 'overrides/sessions'
}
end
end
end
Where have I gone wrong in my routes?