I have a Rails 5 API project for managing user tasks, and I have the following error, but not always for the same controller and route.
ActionController::RoutingError: uninitialized constant Api::V1::ApiController
I will tell you a little about my project to explain the error in more detail.
Application structure

Routes
scope module: 'api' do
namespace :v1 do
scope module: 'login' do
match 'login', to: 'sessions#login', as: 'login', via: :post
end
scope module: 'team' do
resources :tasks, except: [:index] do
collection do
match ':view', to: 'tasks#index', as: 'tasks', via: [:get, :post]
end
end
end
end
end
API controller
module Api
class ApiController < ApplicationController
def respond_with_errors(object)
render json: {errors: ErrorSerializer.serialize(object)}, status: :unprocessable_entity
end
end
end
Command controller
module Api::V1
class Team::TeamController < ApiController
Task controller
module Api::V1
class Team::TasksController < Team::TeamController
Input controller
module Api::V1
class Login::LoginController < ApiController
Session Controller
module Api::V1
class Login::SessionsController < Login::LoginController
When I perform the login and the task route, I get an error message on the last route and all the routes in the command module. If I change the project and save it (only one empty space), and then complete the task route and after login, I get an error message on the last route and all routes in the input module.
It makes no sense ...
