How do you make text and variable in haml appear o

2020-03-31 08:50发布

问题:

I have this code and I want it to read as Volunteers Needed: 10 (event.numberofvolunteers value) on the same line. How can I do this without using css? I haven't found a specific post addressing this issue.

%td Volunteers Needed:
  = event.numberofvolunteers

回答1:

Try this:

%td= "Volunteers Needed: #{event.numberofvolunteers}"


回答2:

Best way to write this would be :

%td Volunteers Needed: #{event.numberofvolunteers}