On Sat, Nov 29, 2008 at 8:14 AM, Andreas Gungl <[EMAIL PROTECTED]> wrote:
>
> MyTable.find_each_by_sql("some SQL here") { |my_table| ... }
>
> MyTable.find_each(:all, :conditions => ...,
> :include => ...) { |my_table| ... }
>
>
Any chance of having these work by scope/proxy, instead? For instance:
MyTable.all.each do |record|
...
end
Or, something like this, with named scopes:
User.registered.customers.each do |user|
...
end
I think this already works, actually -- it just implicitly converts the
AssociationProxy to an array. In other words, it slurps the entire result
set. It would be nice if this behavior could be made to transparently (or
optionally) do what you've implemented, rather than inventing a whole new
interface -- for example, find_each doesn't help when you want to use other
things from Enumerable, like select/reject, inject, etc.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---