Search code examples
ruby-on-railsrubyslim-lang

slim-lang engine line break


I want to use a new-line for each attribute to prettify the code:

<%= link_to(
           'New Issue', 
           { :controller => "issues", action: 'new'}, 
           class: 'btn btnsuccess right') %>

and I want to do it in slim like:

= link_to (
   'New Issue', 
    { :controller => "issues", action: 'new'}, 
    class: 'btn btnsuccess right')

with new-lines.

Obviously I am missing something.


Solution

  • You can actually do it without the backslash and keep the code looking a little cleaner. You just have to make sure your first argument is on the same line as link_to. Like so:

    = link_to 'New Issue',
              { :controller => "issues", action: 'new'},
              class: 'btn btnsuccess right'