How can I pass the variable to inline style tag in rails

Viewed 139

<div style="--rating: <%= rating_value %>">

^Work's fine

but doesn't work with .erb syntax.

<%= content_tag :div, style: "--rating: <%= rating_value %>" %>

what am I missing? Thanx for the answer!

1 Answers

This should work:

<%= content_tag :div, style: "--rating: #{rating_value}" %>
Related