Active record outside of rails

I really like how Active Record logs the SQL that is executed inside of
rails. Is there a way to get the SQL output when using Active Record
outside of rails?

Thanks,

phil

try google on the very title of your message

http://www.google.com/search?q=activerecord%20outside%20of%20rails

You’ll be amazed by the result.

http://www.cultkanaal.nl/Tech/google-bart.jpg

Alain

Alain R. wrote:

try google on the very title of your message

http://www.google.com/search?q=activerecord%20outside%20of%20rails

You’ll be amazed by the result.

Really? It doesn’t obviously contain the answer to the OP’s question
(which was about how to log the SQL when using AR outside of Rails)

Really? It doesn’t obviously contain the answer to the OP’s
question
(which was about how to log the SQL when using AR outside of Rails)

I reacted on the title and the main sentence that says “… a way to get
SQL output…” (SQL output = result, not log). I guess that Phil wants
the “logged SQL commands”, and not the “SQL output”.

I Should have noticed the ambiguity of the message. My bad.

Alain

Thank you very much! I guess I need to start digging in to the
rails/active
record source so I can figure this stuff out…

phil

On 16-dec-2005, at 1:39, Phil S. wrote:

I really like how Active Record logs the SQL that is executed
inside of rails. Is there a way to get the SQL output when using
Active Record outside of rails?

require ‘rubygems’
require ‘active_record’

ActiveRecord::Base.logger = Logger.new(File.dirname(FILE) + “/
debug.log”)

ActiveRecord::Base.establish_connection(hash_of_params)


Julian ‘Julik’ Tarkhanov
me at julik.nl

Phil,

I owe you an apology.

Alain R. wrote:
> try google on the very title of your message
I was wrong.

http://www.cultkanaal.nl/Tech/google-bart.jpg
And I was rude.

Please excuse me.

Alain