Question

I'd like to check a few queries generated by ActiveRecord, but I don't need to actually run them. Is there a way to get at the query before it returns its result?

OTHER TIPS

tail -f log/development.log

Works in default settings or when you set your logger level to DEBUG.

Jamis' article is outdated, or at least doesn't work my Rails app (possibly due to some other reason with a 3 year old 30,000 line app). However this works in a console any time:

ActiveRecord::Base.connection.instance_variable_set :@logger, Logger.new(STDOUT)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top