Recently, I was tasked with creating a redirect from my company's Rails app to an external webpage with a rather long URL.
First, I created an action in the page's controller:
Next, I added a route for said action:
Then I called the route in the page:
Upon code review, my teammate suggested that I create a helper method which returns the URL, then call the helper in the view:
The controller action was unnecessary, superfluous, cumbersome.
Implementing the helper method was so simple, uncluttered, direct.
That some code works never exempts that code from being improved upon.