title: assigning a CSS class from a variable in Ruby/Rails
body: <p>I'm trying to assign the CSS of an element based on it's index in a list.</p>
  
  <p>Here, I stored the CSS, either 'q-light' or 'q-dark' in the variable 'styling1', and it worked perfectly.</p>
  
  <pre><code>    &lt;% answers.each_with_index do |answer, i| %&gt;
      &lt;% styling1 = i % 2 == 0 ? 'q-light' : 'q-dark' %&gt;
  
      &lt;div class="&lt;%= styling %&gt;"&gt;
  </code></pre>
  
  <p>However, when I try to store the index in the variable 'styling2' here, and try to add it to another CSS class, so say the CSS for each element would be 'otherclass 0,' 'otherclass 1,' and so on, it gives me a syntax error saying that I have an unexpected '>'.</p>
  
  <pre><code>    &lt;% answers.each_with_index do |answer, i| %&gt;
      &lt;% styling2 = i %&gt;
  
      &lt;%= f.radio_button :answer_id, answer.id%&gt;
      &lt;%= f.label :answer_id, answer.answer, :class =&gt; "&lt;%= otherclass styling =&gt;" %&gt; 
  </code></pre>
  
  <p>I'm not super sure where the error's coming from. I know that CSS classes aren't supposed to start with numbers, but I named them with the unicode escape characters so instead of 0 it's \30 in my css files, and that styling works elsewhere, so I don't think it's the numbers. Could it be that I can't call a variable when I assign the class like ":class =>"?</p>