Im updating to rails 3 and experience the problem of writing the content of a array to a html view. If I just place the array like:
<%= array %>
It gets now outputed as:
["...","...","..."]
with rails 2 it was just the content which got printed...
Any Ideas?
开发者_开发知识库Markus
<%= array.join ' ' %>
You can try using array#to_sentence method:
<%= array.to_sentence %>
Or just a join:
<%= array.join(", ") %>
Depends on how you want the output to look.
If it's for debugging purposes, why not try:
<%= debug array %>
if you need to present the array in a specific way, you're better off iterating the array and presenting each element with a repeatable block or a partial.
精彩评论