Rails nested routes

March 15, 2021

Rails 6.1 offically fixed large routes file! Here is an example of how to do this:

config/routes.rb

Rails.application.routes.draw do
  draw(:api)

  root 'home#index'
end

config/routes/api.rb

namespace :api, defaults: { format: :json } do
  devise_for :users
end

Search