Forum: Ruby on Rails Showing SQL in script/console

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community 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.new(STDOUT)
=> #<Logger:0x866a89f4 @level=0, @progname=nil,
@logdev=#<Logger::LogDevice:0x866a7f7c @filename=nil,
@mutex=#<Logger::LogDevice::LogDeviceMutex:0x865c1c34
@mon_entering_queue=[], @mon_count=0, @mon_owner=nil,
@mon_waiting_queue=[]>, @dev=#<IO:0x817acafc>, @shift_size=nil,
@shift_age=nil>, @formatter=nil,
@default_formatter=#<Logger::Formatter:0x866a8814
@datetime_format=nil>>
>>

Jeremy
This topic is locked and can not be replied to.