Messy &quot returned from Rails 3 controller to view

我的未来我决定 提交于 2019-12-06 12:13:20

问题


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!


回答1:


What about:

<%=raw @data_dump %>


来源:https://stackoverflow.com/questions/6131347/messy-quot-returned-from-rails-3-controller-to-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!