From: Ilan Berci Date: 2007-04-04T23:29:52+09:00 Subject: Re: Problem Extracting Array Values Dustin Anderson wrote: > Hi All, > > I'm trying to iterate through an array and pull each value into a view > on my Rails app. The array is stored in a MySQL database. > Dustin, For future reference, could you please refer all rails related questions to the rails forum. > The array is in a varchar (string) column named "blocks" with the value: > ["journal", "about", "news"] > > I'm trying to pull each value out one at a time. > > If I try to access the array with something like this...: > <%= @blocks[0] %> > > ...the view returns a numeric value: > 91 > @blocks is not the type you think it is, I am taking a wild stab here but 91 is the ascii code for "[" so I believe @blocks is a string: irb(main):007:0> @blocks = "['journal', 'about']" => "['journal', 'about']" irb(main):008:0> @blocks[0] => 91 irb(main):009:0> hope this helps ilan -- Posted via http://www.ruby-forum.com/.