Forum: Ruby on Rails Showing SQL in script/console

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jeremy E. (Guest)
on 2006-05-19 00:46
(Received via mailing list)
Is there an easy way to display the SQL in script/console (similar to
what is done in development.log)?  The following works but it's ugly:

$ script/console
Loading development environment.
>> class ActiveRecord::ConnectionAdapters::AbstractAdapter
>>   def logger= (logr)
>>     @logger = logr
>>   end
>> end
=> nil
>> ActiveRecord::Base.connection.logger =
=> #<Logger:0x866a89f4 @level=0, @progname=nil,
@logdev=#<Logger::LogDevice:0x866a7f7c @filename=nil,
@mon_entering_queue=[], @mon_count=0, @mon_owner=nil,
@mon_waiting_queue=[]>, @dev=#<IO:0x817acafc>, @shift_size=nil,
@shift_age=nil>, @formatter=nil,

This topic is locked and can not be replied to.