Right now, I am using the helper method raw to output content from a helper method
Here’s my view:
%ul.unstyled.barges.sortable.connectedSortable.ui-widget-content
= raw show_list(list, columns)
And here’s my helper:
def show_list(list, columns)
content = ""
0.upto(columns) do |c|
content << render(:partial => 'barges/barge', :locals => {:barge => list.select{|barge| barge.location_column == c}.first})
end
content
end
Is there a way to eliminate the necessity to use raw? If I don’t use raw, then the html will be returned as a string to the view.
If you’re sure the content is always going to be safe to output as HTML (i.e. no user input), you can return
contentashtml_safefrom your helper: