Search code examples
ruby-on-railsrubyerbslim-lang

How to convert HTML with Ruby helper method ERB into Slim syntax


Trying to convert some HTML code in a template to Slim syntax. The original code uses a Ruby helper method (in Rails) to dynamically determine the class of the li element.

Here is the original code in HTML:

<li class="<%= is_active_controller('dashboards') %>">

The online converter gives:

| <li class="
= is_active_controller('dashboards')
| ">

This not only is ugly and clunky--it doesn't work.

I've tried various options without success. Such as:

li class=is_active_controller('dashboards')

...as well as several other variations without success.


Solution

  • li class=(is_active_controller('dashboards'))