Ruby interpolation in class name

interpolation, ruby

Solution

There's no need to interpolate from within your ERB tags. Try the following instead:

<div class="fact-circle--<%= i %>" data-number="20">

The alternative (which includes interpolation) would be as follows:

<div class='<%= "fact-circle--#{i}" %>' data-number="20">

Problem

I have the following line: ``` <div class="fact-circle--<%= #{i} %>" data-number="20"> ``` I thought it was possible to interpolate ruby variables like that? It's choking on the "<" of the opening ERB tag. Any ideas?

Original source