On 5/19/07, Dan Manges <[EMAIL PROTECTED]> wrote:
>
> On May 18, 3:14 pm, "S. Robert James" <[EMAIL PROTECTED]> wrote:
> > I use sanitize_sql all the time. But that's not what I meant. Let me
> > illustrate:
> >
> > Product.get_sql_of {Product.find(:conditions => 'cost < 3')}
> > # => 'SELECT * FROM products WHERE cost < 3'
>
> This should work:
>
> class << ActiveRecord::Base.connection
> def execute_with_capture(*args)
> @queries ||= []
> @queries << args
> execute_without_capture(*args)
> end
> alias_method_chain :execute, :capture
> end
>
> ActiveRecord::Base.connection.instance_variable_get("@queries")
I'm not sure, but I think that would leak memory like crazy :)
--
Rick Olson
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---