Today I want to share a quick Ruby on Rails tip that I have used in the past and just used again in a recently inherited codebase.
The general problem under consideration is when you have route specifications where you want to change the syntax, but you didn’t want to change how the application works. I had done this in the past when upgrading a Rails app from version 2 to version 3, and yesterday I wanted to make some route changes to reduce deprecation warnings at the beginning of test runs.
In this case, I was getting some deprecation warnings about the syntax of the route. For example:
DEPRECATION WARNING: Defining a route where `to` is a controller without an action is deprecated. ...
So I wanted to fix the underlying issue but leave the routes otherwise unchanged.