Reputation: 289
I'm trying to add embedded ruby into my css style width tag.
Here is what the code currently looks like:
<div class = "progress progress-info">
<%target = (((@candidate.civillibscore.to_f)/111.37)*100.0).to_s%>
<div class="bar" style="width: <%target%>%">
Not sure if I'm just screwing up the target variable, or if my floats are off (it's printing the right percentage), but any help would be appreciated!
Upvotes: 0
Views: 662
Reputation: 1629
Put =
after this code <%
. So it should look like this <%=
without =
the value will not show.
Upvotes: 1
Reputation: 11588
You're missing an equals sign after the <%
(should be <%=
):
<div class="bar" style="width: <%= target %>%">
Upvotes: 2