How to debug a Slim Template?

352 Views Asked by At

I have a Bootstrap Table, built with Slim, using Ruby to populate the table with data. Being new to Slim, I'm unsure as to how I can best debug it. As an example, in the table below I would like to look inside the loop, and take a closer look at whats being outputted.

Binding.pry has zero effect, so clearly I'm doing this wrong.

NB. I would like to be able to navigate line by line through this slim template, rather than simply debugging the source scripts.

  tbody.activities
  - @case_file_activities.each do |activity|
    tr
      - activity_cell = cell(:activity, activity)
      td: code == link_to(activity.slug, activity_cell.path)
1

There are 1 best solutions below

0
Salomanuel On

have you tried using slim tags?

    tbody.activities
    - @case_file_activities.each do |activity|
      - binding.pry
      tr
        - activity_cell = cell(:activity, activity)
        td: code == link_to(activity.slug, activity_cell.path)

in slim, = is a Ruby call that produces output, as in <%= omgomg =%>
and - is Ruby control code, as in <% blabla %>