I have an object in my controller
@data="<meta property=\"og:url\"
content=\"<%=SITE_URL%><%=request.request_uri%>\"
/>".html_safe
When I print this in my view file by <%=@data%> the html that it generates is
<meta property="og:url"
content="<%=SITE_URL%><%=request.request_uri%>"
/>
How do i print out/escape the ruby code withing the string?
You’re looking for string interpolation, which means that in the string, it substitutes the value of the variable. Surround the variables with #{} like this:
http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Literals#Interpolation
Now, when you do
<%= @data %>, it should show up normally.