Should be a relatively simple question — I’m trying to add a css class (“quiz-question”) to this line:
<%= @question.text %>
If I add it directly after
<%= @question.text :class => "quiz-question" %>
I get an argument error saying wrong number of arguments (1 of 0), and I’ve tried separating with a comma or putting the class inside curly brackets. What’s the correct way to include here?
It doesn’t work because you’re trying to pass an argument to a displayed item.
@question.textisn’t a tag, a block, a helper, etc. It’s only text. And thus, you can’t give it a class.Why don’t you do
<span class="quizz-question"><%= @question.text %></span>?