I'm using the gem "slim-rails"
and I need to put on the file application.html.slim
inside the head
tag a style css like this:
<style>
<% State.all.each do |state| %>
.state-<%= state.name.parameterize %> {
background-color: <%= state.color %>;
}
<% end %>
</style>
I was trying in this way:
style
- State.all.each do |state|
.state-
= "#{state.name.parameterize}" {
background-color: = "#{state.color}";
}
But was unsuccessfully. the error:
Malformed indentation
/Users/romenigld/ror_workspace/projects/news_city/app/views/layouts/application.html.slim, Line 20, Column 12
}
^
It has a way for this using helpers?
I fix putting on the partial of the views/states/_state.html.slim
this:
span class="label state state-#{state.name.parameterize}" style="background-color: #{state.color};"
= "#{state}"