On 06.02.2009 17:21, Shandy Nantz wrote:
> I need to create an unknow number of arrays on the fly (could be 1 array
> could be 10, I don't know), is there a way to do this in Ruby and also
> name them dynamically? I also need to set those array's to a collection
> of stuff found in a table. My Ruby is pretty rusty, and I am not sure if
> I can simply set an array to a group of stuff. If I have rows in a table
> that can be accessed by saying @user.table_name, can I say:
> 
> a = Array.new
> a = @user.table_name

You can say, or rather: write, that - but the effect would be 
disappointing.  The second assignment simply overwrites the first one 
rendering it completely superfluous.

You can do this

arrays = Array.new(how_many) {[]}

Cheers

	robert