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.
Fba04dfe5f677c48caee082d87c15b9f?d=identicon&s=25 Phil Swenson (Guest)
on 2005-12-16 01: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
B45eab4f18aa1bb2a44d6e657531a642?d=identicon&s=25 Alain Ravet (aravet)
on 2005-12-16 01: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
Eea7ad39737b0dbf3de38874e0a6c7d8?d=identicon&s=25 Justin Forder (Guest)
on 2005-12-16 13:04
(Received via mailing list)
Alain Ravet 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)
B45eab4f18aa1bb2a44d6e657531a642?d=identicon&s=25 Alain Ravet (aravet)
on 2005-12-16 13: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
A2b2f4ee23989dc68529baef9cbddcd6?d=identicon&s=25 Julian 'Julik' Tarkhanov (Guest)
on 2005-12-16 14:17
(Received via mailing list)
On 16-dec-2005, at 1:39, Phil Swenson 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
Fba04dfe5f677c48caee082d87c15b9f?d=identicon&s=25 Phil Swenson (Guest)
on 2005-12-16 14: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
0091f92762685860109bbcb02edfdf27?d=identicon&s=25 Alain Ravet (Guest)
on 2005-12-22 09:31
(Received via mailing list)
Phil,

I owe you an apology.

Alain Ravet 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.