This project is archived and is in readonly mode.

#1935 ✓committed
Will Bryant

Array.wrap handling of association collections

Reported by Will Bryant | February 11th, 2009 @ 01:55 AM | in 2.x

Array.wrap doesn't DWIM with associations:

Array.wrap(Icp.find(16).registers) => [[#<Register ...>]]

Array.wrap(DisputedRead.unresolved) => [[#<DisputedRead ...>, #<DisputedRead ...>]]

ie. array-like collections and scopes aren't getting treated as arrays and are being wrapped again.

The attached patch checks if the given object responds to to_ary, and if so returns that.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket


Referenced by