2

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

3 Answers 3

10
<%= array.join ' ' %> 
Sign up to request clarification or add additional context in comments.

1 Comment

This is the solution I was looking for
5

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.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.