From: ara.t.howard@... Date: 2007-04-05T00:13:30+09:00 Subject: Re: Problem Extracting Array Values On Wed, 4 Apr 2007, Dustin Anderson wrote: > >> Dustin, why are you storing those values that way? Why not have a >> normalized table with a row for each? In other words you create a >> blocks table, define a Block model which belongs_to whatever model you >> currently use the blocks column in, and then that model will have many >> blocks. Then you could just do @model.blocks.each do |block| in your >> view. >> >> Ryan > > Thanks Chris, ilan, Ryan for the help... You got it exactly correct. > > Ryan - I think you're right - I was storing the value in the database > like that because it's a variable for a Javascript app. I'm writing an > app to allow users to store the state of the view (like Google > personalized homepage or netvibes) and the javascript that I'm using > requires a v to look like this: > > value = ["block1_name", "block2_name", "block3_name"] > > so, if I store "value" in the database like this, I can just read it > into my javascript. Otherwise, I'll need a helper to construct the > string to look like this. not really values = ["block1_name", "block2_name", "block3_name"] javascript = "value = #{ values.inspect }" fyi. -a -- be kind whenever possible... it is always possible. - the dalai lama