Is there any tool to convet ActiveRecord 2.3.5 statement to sql

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there any tool to convet ActiveRecord 2.3.5 statement to sql

nyt1972
Hello,

I want to ask Is there any tool to convet ActiveRecord 2.3.5 statement to sql?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f973c881-81c7-46ec-a8a6-f4d894bd03f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Is there any tool to convet ActiveRecord 2.3.5 statement to sql

kaine wright
This may help http://guides.rubyonrails.org/v2.3.11/active_record_querying.html

what is it you are trying to convert. Do you mean you wish to add a column to your database to store information if so you would use your model and migrations

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/836abccd-04d0-413f-b954-01a8ff443ea6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Is there any tool to convet ActiveRecord 2.3.5 statement to sql

Hassan Schroeder-2
In reply to this post by nyt1972
On Fri, Apr 13, 2018 at 10:13 PM, nyt1972 <[hidden email]> wrote:

> I want to ask Is there any tool to convet ActiveRecord 2.3.5 statement to
> sql?

If it's a one-time or occasional thing, just execute the statement
and grab the query SQL from your logs.

There are also `to_sql()` methods in ActiveRecord::Relation and
ActiveRecord::ConnectionAdapters::DatabaseStatements which
(hint) you could find by searching the docs.

HTH,
--
Hassan Schroeder ------------------------ [hidden email]
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yCFD5WnBQ1%2BH8ODBiav8q4fq5%3DpuNDWr0u%3D4gs6CoJogA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Is there any tool to convet ActiveRecord 2.3.5 statement to sql

snappa
In reply to this post by nyt1972
Should be able to see the SQL in the debug log if you have it enabled.

On Saturday, April 14, 2018 at 2:22:46 AM UTC-4, nyt1972 wrote:
Hello,

I want to ask Is there any tool to convet ActiveRecord 2.3.5 statement to sql?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b11eaf5f-644a-4629-8f88-e118e39e9626%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Is there any tool to convet ActiveRecord 2.3.5 statement to sql

tonypm
In reply to this post by Hassan Schroeder-2
For ActiveRecord in Rails 2.3, you can useĀ 

.construct_finder_sql({})

tonypm

On Saturday, 14 April 2018 15:13:15 UTC+1, Hassan Schroeder wrote:
On Fri, Apr 13, 2018 at 10:13 PM, nyt1972 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="_FDjNa2VAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">nyt...@...> wrote:

> I want to ask Is there any tool to convet ActiveRecord 2.3.5 statement to
> sql?

If it's a one-time or occasional thing, just execute the statement
and grab the query SQL from your logs.

There are also `to_sql()` methods in ActiveRecord::Relation and
ActiveRecord::ConnectionAdapters::DatabaseStatements which
(hint) you could find by searching the docs.

HTH,
--
Hassan Schroeder ------------------------ <a href="javascript:" target="_blank" gdf-obfuscated-mailto="_FDjNa2VAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">hassan.s...@...
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/baa4af28-9d4d-42be-b82f-473537327f1c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.