82

I have a simple fixture.yml file:

label:
    body: "<%= variable %>"

The issue is that the ERB code is parsed as part of loading the fixture, whereas I actually want the body to be literally "<%= variable %>" (un-interpolated).

How do I escape the ERB tag?

Alex Harvey
  • 11,553
  • 2
  • 42
  • 73
Daniel
  • 6,858
  • 5
  • 40
  • 46

1 Answers1

132

Add a second % to the opening tag:

label:
    body: "<%%= variable %>"

The <%% sequence is valid ERB, rendered as a literal <%.

molf
  • 68,548
  • 13
  • 132
  • 117