You have asked it to show the array and it has done so. What are you
trying to do? Possibly you need something to use something like
array.each. Possibly have a look at some basic Ruby tutorials (as
opposed to Rails tutorials).
using 1.9.1
I presume that is the version of Ruby, I don’t know which version of
Rails you are using, but I believe there are problems with ruby 1.9.1
and some versions of rails.
Im not getting the output I expect. In the tutorial I am doing. It is
suppose to just write the values to the browser.
Which would write a,b,c to the browser and shouldn’t also be showing the
array brackets or double quotes.
Then I would be able to continue to call the values of the array and write
the results to a browser using ruby code within the erb file.
My question: Whats wrong with the code I’m writing?
There’s nothing wrong with your code, it’s working perfectly. But if
you want to iterate the array, there are several ways.
Most commonly, you can use “.each”:
<% array = [‘a’,‘b’,‘c’] %>
<% array.each do |element| %>
<%= element %>
<% end %>
but if the format you’ve noted is specific (“a,b,c”) then you can use
the “.join” method:
Im not getting the output I expect. In the tutorial I am doing. It is
suppose to just write the values to the browser.
Which would write *a,b,c *to the browser and shouldn’t also be showing
the
array brackets or double quotes.
Then I would be able to continue to call the values of the array and
write
the results to a browser using ruby code within the erb file.
My question: Whats wrong with the code I’m writing?
Thanks for your feedback!
On Tue, Aug 31, 2010 at 1:48 AM, Michael P. [email protected]
wrote: