From: David Vallner Date: 2006-01-12T19:49:36+09:00 Subject: Re: hash in hash, iterating the members I suppose you've used PHP before? In Ruby, strings and numbers are NOT equivalent in any context I can think of. at least by default. More notably: irb(main):001:0> 1.hash => 3 irb(main):002:0> "1".hash => 50 irb(main):003:0> :Data.hash => 929038 irb(main):004:0> "Data".hash => 141011718 As you can see, the number 1 has a different hash code than the string "1", same forthe symbol :Data and the string "Data". Make a simple rails view that will dump params as text and check if you are indeed indexing the data by the actual keys in the hash. David Vallner On Thu, 12 Jan 2006 11:28:06 +0100, Depili wrote: > I'm quite new to ruby and I'm learning with ruby on rails, but I have > hit a brick wall, because I want to parse several fields from a web > form which give the same data in a loop and maintaining the order from > the web form. > > So I have a form with fields like: > > Data[1][Name] Data[1]Notes ..... > Data[2][Name] Data[2]Notes ..... > > and the params hash looks like > > {"Data" = {"1" = {"Name" = "foo", "Notes"="bar"}, "2" = {..... > > I can access the fields easily when the keynames are strings, but with > numbered keys params[:Data][1] doesn't work. Also params[Data].each do > |data| leads to errors,,, > > I would like to get a way of accessing the hashes inside data for > creating new database entries in rails. > >