From: Xavier Noria Date: 2007-12-07T04:44:32+09:00 Subject: Re: array iterator that have more arrays that also need iteratio On Dec 6, 2007, at 8:25 PM, Raimon Fs wrote: > I have one array, and each element of this array, has another array. > > here is may array dumped: > > - - !ruby/object:InvoicesCalcul > attributes: > 1600_base: "82567.36" > 1600_value: "95778.21" > 1600_tax: "13210.85" > - - !ruby/object:InvoicesCalcul > attributes: > 700_tax: "17.91" > 700_base: "255.81" > 700_value: "273.72" > - - !ruby/object:InvoicesCalcul > attributes: > 0_base: "707.59" > 0_tax: "0.0" > 0_value: "707.59" > > I need: > > 82567.36 95778.21 13210.85 > 17.91 255.81 273.72 > 707.59 0.0 707.59 Looks like you have a collection of InvoicesCalcul, each of them with an accessor "attributes", which is a hash: values = invoice_calculs.map do |ic| ic.attributes end.map do |a| a.values end.flatten Those could be AR objetcs, in Rails you can write that this way: values = invoice_calculs.map(&:attributes).map(&:values).flatten -- fxn