My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Automating a redirect_to / flash cleanup ·

Betty Chang's photo
Betty Chang
·Aug 16, 2017

If you're like me and have an application with some pockets of very outdated Rails idioms, you may have code like this in your controllers: This can of course be rewritten to use a Hash as the second argument to redirect_to: And there's a similar, but slightly different, transformation that can be made for setting error flash messages: I had a bunch of these changes that needed fixing up, and it would have taken around 15 minutes to search around the codebase and fix all the references.