I have the following code in a .erb file:
<% embed='<a href="http://someurl.com/whatever">#{@webcast.name}</a>'%>
<p id="embedCode">
<pre>
<code>
<%= embed %>
</code>
</pre>
</p>
The anchor tag is correctly displayed onscreen as text rather than rendered as a dom element, however the string interpolation is failing. The html is successfully displayed as text but #{@webcast.name} is not evaluated. If a include <%= @webcast.name => in the template, the webcast name in rendered successfully.
Because strings delimited with single quotation marks
''are not interpolated.Change your code to e.g.:
or (if you want to avoid masking the double-quote characters
")or just (thanks to Samy Dindane for the hint):