You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In MRI Ruby, when you iterate over an object providing a block with extra parameters, it seems that #to_ary is called and, if it returns nil, is disregarded. This is a test that you can execute to see the behavior on different Rubies:
On MRI versions, this passes. On JRuby 1.7.22, it returns [nil] and thus fails. On JRuby 9.0.1.0, it raises an exception: TypeError: Example#to_ary should return Array. It seems that the behavior in this case should conform to the behavior on MRI, in order to avoid surprising behavior when attempting to use map, each and other enumerable methods.
In real projects, this is observable on any ActiveRecord object as well as DelayedJob, as seen in Issue #3338.
Note -- I am opening this bug for 1.7.22 per a request from @enebo .
The text was updated successfully, but these errors were encountered:
In MRI Ruby, when you iterate over an object providing a block with extra parameters, it seems that #to_ary is called and, if it returns nil, is disregarded. This is a test that you can execute to see the behavior on different Rubies:
On MRI versions, this passes. On JRuby 1.7.22, it returns [nil] and thus fails. On JRuby 9.0.1.0, it raises an exception: TypeError: Example#to_ary should return Array. It seems that the behavior in this case should conform to the behavior on MRI, in order to avoid surprising behavior when attempting to use map, each and other enumerable methods.
In real projects, this is observable on any ActiveRecord object as well as DelayedJob, as seen in Issue #3338.
Note -- I am opening this bug for 1.7.22 per a request from @enebo .
The text was updated successfully, but these errors were encountered: