1

Let's say I want to display in an erb page a hint on how to write erb:

in helpfile.html.erb:

Here's the right way to write a basic erb statement: <%= a = 1 %>

The problem is that when that erb file is processed as a view in rails, the literal erb <%= gets interpreted and so in the file displayed I just see

Here's the right way to write a basic erb statement: 1

How do I do that?

halfer
  • 19,824
  • 17
  • 99
  • 186
pitosalas
  • 10,286
  • 12
  • 72
  • 120

2 Answers2

2

You could either write it as:

Here's the right way to write a basic erb statement: <%= '<%= a = 1 %>' %>

Or perhaps as:

Here's the right way to write a basic erb statement: &lt;%= a = 1 %&gt;
lurker
  • 56,987
  • 9
  • 69
  • 103
1

Try using an entity:

<&#37;= Here's the right way to write a basic erb statement: 1 &#37;>
jdussault
  • 427
  • 5
  • 12