After upgrading to rails 4 the executed SQL is no longer shown when I execute commands in the rails console on my server in production. How can I enable that again, without hurting the performance?
As a Rails developer, you’ll end up spending a lot of time in the Rails console. It’s like a back door to your application. Using the console lets you interact with parts of your app directly from a command-line interface without going through a browser.
To run the Rails console in RubyMine, perform the steps below: 1 Do one of the following:#N#Press Ctrl twice and type the question mark in a popup. Then, find the rails c command in a... 2 (Optional) In the invoked dialog, select the required environment and press OK. More ...
The Rails development environment is streamlined for rapid feedback. You can make code changes in your favorite code editor, then hit Reload in your browser to quickly see the effect of those changes. This works because your application code is automatically reloaded on every request when you’re running in the development environment.
There is the .explain method in Rails 4. Category.includes (:products).explain => EXPLAIN for: SELECT "categories".* FROM "categories" 0|0|0|SCAN TABLE categories EXPLAIN for: SELECT "categories_products".*
ActiveRecord::Base.logger = Logger.new(STDOUT)
Execute it in rails console on your server, and then all the ActiveRecord generated SQL queries will be shown.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With