I'm trying to create an api controller for a model defined in a module
Model class:
module Reports
class Report < ActiveRecord::Base
end
end
Api controller:
class API::V2::ReportsController < API::V2::BaseController
end
Route:
namespace :api, defaults: { format: :json } do
namespace :v2 do
resources :reports
end
end
The error I get when try to call api/v2/reports is:
LoadError (Unable to autoload constant Report, expected /.../app/models/reports/report.rb to define it):
Is there a way to solve this, making the api controller look for Reports::Report instead of Report?