On Wed, Mar 9, 2011 at 11:32 PM, Peter D Bethke <[email protected]>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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


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

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to