This project is archived and is in readonly mode.
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
-
Repository February 11th, 2009 @ 02:03 AM
- State changed from new to committed
(from [1a2a71333f197e98d1cd7fe380d613cbada4446b]) Array#wrap should use #to_ary so association collections and named scopes are not re-wrapped
[#1935 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net http://github.com/rails/rails/co...
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
- Nobody is watching this ticket.
Attachments
Tags
Referenced by
- 1935 Array.wrap handling of association collections [#1935 state:committed]