Forum: Ruby on Rails active record outside of rails

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.
Phil S. (Guest)
on 2005-12-16 02:41
(Received via mailing list)
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
Alain R. (Guest)
on 2005-12-16 02:48
try google on the very title of your message

    http://www.google.com/search?q=activerecord%20outs...
You'll be amazed by the result.

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

Alain
Justin F. (Guest)
on 2005-12-16 14:04
(Received via mailing list)
Alain R. wrote:
> try google on the very title of your message
>
>     http://www.google.com/search?q=activerecord%20outs...
> 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)
Alain R. (Guest)
on 2005-12-16 14:53
   > 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
Julian 'Julik' Tarkhanov (Guest)
on 2005-12-16 15:17
(Received via mailing list)
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 S. (Guest)
on 2005-12-16 15:53
(Received via mailing list)
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
Alain R. (Guest)
on 2005-12-22 10:31
(Received via mailing list)
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
This topic is locked and can not be replied to.