How Can I Hide Unused Rails Routes From bin/rails routes
Output?
I have a brand new Rails 6 app and the output of bin/rails routes
includes a massive list of very long urls for ActiveStorage, Action Mailbox, and conductor.
I don’t want to omit these parts of Rails as I may need them in the future. But I would prefer for these routes not to be visible in bin/rails routes
. Is there a way to make this work?
# config/routes.rb
Rails.application.routes.draw do
# Your routes here
end
You can use the exclude
option in bin/rails routes
command to exclude the routes that you don’t want to see in the output.
For example, to exclude routes for ActiveStorage, Action Mailbox, and Conductor, you can use the following command:
bin/rails routes -e active_storage,action_mailbox,conductor
You can also add this option permanently to your Rails configuration by adding the following line to your config/application.rb
file:
config.web_console.whitelisted_ips = '192.168.0.0/16'
Replace the IP address with your own IP address or the IP address range that you want to whitelist.