ben
ben

Reputation: 29767

"<br>" being changed to "<br>" even though I'm using html_safe?

I am calling a helper method from a view to display some media.

index.html.erb

<%= media_display(:media => m[:media], :thumbnail => true).html_safe %>

application_helper.rb

def media_display p = {}
    (image_tag p[:media].author_picture) + "<br>"
end

HTML output

<img src="path_to_image" alt="Bartolo_normal">&lt;br&gt;

The image HTML works fine. Why is <br> not coming through as allowed HTML?

Upvotes: 0

Views: 1703

Answers (1)

jonnii
jonnii

Reputation: 28312

Change it to this:

raw("<br>")

Upvotes: 1

Related Questions