2

On my Rails 3 app controller I have the following code:

array = []
Location.all.each{|x|array<<x.city.html_safe}
@data_dump = array

In the Rails console it looks nice and clean:

["Littelside", "Tessmouth"]

In my view the @data_dump object gets encoded:

[&quot;Littelside&quot;, &quot;Tessmouth&quot;]

How do you clean this mess up? I want my object in view, to return as the object does in terminal. Thanks in advance!

Roberto Decurnex
  • 2,514
  • 1
  • 19
  • 28
JZ.
  • 21,147
  • 32
  • 115
  • 192
  • 1
    Show your view code. And it looks like everything is fine. – fl00r May 25 '11 at 21:50
  • 1
    It looks like in your view is calling `to_s` on the array, and then html encoding it. Do you want `to_s` or to use the contents of the array somehow? – Matt Greer May 25 '11 at 21:54

1 Answers1

10

What about:

<%=raw @data_dump %>
apneadiving
  • 114,565
  • 26
  • 219
  • 213