Development.log log file isn't logging Rails SQL queries
Ensure that your log level is set to :debug
in config/environments/development.rb
, like so:
config.log_level = :debug
Apparently showing the SQL in the console rather than development.log is default behavior for Rails 3.1. I haven't found a configuration option for changing that behavior, but I have found that, once the console is running, you can just do:
irb(main):001:0> ActiveRecord::Base.logger = Rails.logger
and that will take the sql out of the console and put it back in development.log. Or, if you don't want to do that every time you fire up the console, you can edit gems/railties-(version)/lib/rails/console.rb, and make the above assignment after the line in the start method that reads:
@app.load_console
Not saying it's a good solution, but it'll tide me over until I find something better...
Combining KenB's answer and how can i load a file in ruby on rails console?,
simply create a .irbrc file and include the following line:
ActiveRecord::Base.logger = Rails.logger