Use Controller Via Routes in Rails Console
If you need to hit a route from your Rails console and see the output you can use the following pattern. You now have a rails response object much like the integration tests.
If you need to hit a route from your Rails console and see the output you can use the following pattern. You now have a rails response object much like the integration tests.
You can output the raw query for an Active Record Query by tagging .explain at the end. Very useful for complex queries where it’s hard to understand what is happening under the hood 🤯. You can read the docs for more info.