Re: Outputting SQL to page

Jim Ruther Nill
2011-03-09T23:54:38Z

On Wed, Mar 9, 2011 at 11:32 PM, Peter D Bethke
<peter.bethke-ee4meeAH724@public.gmane.org>wrote:

> Hi,
>
> I''m interested in just outputting the SQL from a AR find()
construct to the
> page - without having to look at the console. I tried doing this:
>
> self.joins(...)\
>        .select(...)\
>        .where(...)\
>        .order(...)\
>        .to_s
>
>
use .to_sql


> thinking that it would output the sql as a string, but its just an AR
> object apparently. (note - I removed the particulars of the query for this
> example but they work fine and the query is visible in the console).
>
> Any ideas? Newbie, obviously and working _really_ hard to embrace non-hand
> coded SQL. :)
>
> Thanks!
>
> Peter
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com