85

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
  • 14,494
  • 5
  • 61
  • 97
Daniel
  • 7,006
  • 7
  • 43
  • 49

1 Answers1

137

Add a second % to the opening tag:

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

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

molf
  • 73,644
  • 13
  • 135
  • 118