Slim is much simpler than erb !

I learned about the slim templating language from the Rails Style Guide on GitHub. I found slim extremely easy to set up – just added it to my gemfile, and started making new view files using the .html.slim ending rather than the .html.erb ending.

Slim is a lot less cluttered than erb is. Using slim, I simplified and cleaned up some templates that used to look like this in erb:

  <table class="table">
        <th>Service date(s)</th>

      <% @send_asi_missions.each do |m| %>
          <td><%= link_to "INT#{}", '#' %></td>
          <td><%= m.client.english_name %></td>
          <td><%= ', ' %></td>
          <td><%= ', ' %></td>
          <td><%= ', ' %></td>
          <td><%= ', ' %></td>
          <td><%= m.items.count %></td>
      <% end %>

so that they now look this this in slim:


        th Mission
        th Client
        th Service date(s)
        th Vendor
        th Factory
        th Service
        th Items

      - @send_asi_missions.each do |m|
          td = link_to "INT#{}", '#'
          td = m.client.english_name
          td = ', '
          td = ', '
          td = ', '
          td = ', '
          td = m.items.count

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s