On May 19, 12:14 am, "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'
>
> It's easy for that case, but for complicated finders, and especially
> custom finder methods (eg Product.find_on_sale), it can be very
> helpful, if you want to make more powerful queries and reports.
>
> An rough example might be taking a method Product.find_on_sale and
> writing a metaquery to let us know who bought any of those items, or
> some stats on the top selling all items.
This is not possible without modifying ActiveRecord. You'll have to
modify the find_one, find_every, or find_by_sql methods to attach that
information to all the objects returned by a query.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---