In Ruby 1.9, the library was modified so that iteration returned an Enumerator object if they were called without a block. A number of other language features were also modified, and it was widely known that compatibility would be compromised between Ruby 1.8.x and Ruby 1.9 in the interest of improving the language as a whole. Most people did not find this too sad.
The Ruby development team decided that Ruby 1.8.7 should be a transition release by adding some of the library features that Ruby 1.9 introduced. They took a lot of criticism for the decision, and many users of corporate Ruby stayed (and many of them still remain) with Rails on Ruby 1.8.6 because they feel that the changes made to 1.8.7 are too big and too risky. But, nevertheless, 1.8.7 remains, and iteration functions are returned. Enumerators are one of the features that have been included.
It is this migration function that you see in 1.8.7, which is missing in 1.8.6.
Answer
sepp2k provides a good workaround. I have nothing to add to this.
Ken bloom
source share