On 28/05/2007, at 11:46 AM, giles bowkett wrote:

> Total subtle psychological difference, but with Rails having such
> incredible success, a little thing like that will encourage a lot of
> new Ruby programmers to use iterators instead of explicit iteration.
> For many programmers this is a big change:
>
> http://technotales.wordpress.com/2007/04/14/explicit-iteration- 
> considered-harmful/

He doesn't provide any examples of what he "considers harmful", but I  
think you've misunderstood his point. He's basically saying: if you  
need to do some work on a collection of objects you probably don't  
need to explicitly iterate over the collection; you can use the  
Enumerable methods instead.

For example, I believe he means that:

   orders.select(&:complete).each(&:archive!)

is better than:

   orders.each do |order|
     if order.complete?
       order.archive!
     end
   end

There's nothing wrong with the way the scaffolding iterates (for x in  
y).

-- tim


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to