Search code examples
ruby-on-railsslim-lang

list item not rendering as child of ul


I'm trying to build a ul using slim in rails. It appears to render correctly, but when I look at the code the list is empty.

.row
    ul.file-list
    - @file_items.each do |file_item|
      li.row.file-item
        .col-lg-9
          p.label
            = "#{file_item[:path]}/#{file_item[:name]}"
          p.file-size
            = "#{number_to_human_size(file_item[:size]).downcase} | "
        .col-lg-1.pull-right
          = check_box_tag  "file_id_#{file_item[:id]}", file_item[:id], false, class: 'file-box'

Solution

  • Make sure indentations is proper.

    .row
        ul.file-list
        - @file_items.each do |file_item|
          li.row.file-item
            .col-lg-9
    

    This should be like this.

    .row
        ul.file-list
          - @file_items.each do |file_item|
            li.row.file-item
              .col-lg-9