...

/

Never Configure Routes That Aren’t Being Used

Never Configure Routes That Aren’t Being Used

Learn about which routes we should not configure in a Rails application.

Why shouldn’t we use bin/rails routes?

Running bin/rails routes on an app is a great way to get a sense of its size, scope, and purpose. If the output of that command lies as ours currently does, it’s not helpful. It creates confusion. More than that, it allows us to use a URL helper that will happily create a route that will never work.

Using the only: parameter

The solution is to use the optional only: parameter to resources. This parameter takes an array of actions that we intend to ...