0

3 つの列を持つテーブルがありtime_ago_in_words、同じセルにドキュメント名を追加するのが困難です。

私はいくつかの異なる反復を試みましたが%td= document.name, time_ago_in_words(document.created_at)、役に立ちませんでした。

ハムル:

%table.table.table-striped
    %thead
      %tr
        %th Name
        %th Download Link
        %th  
    %tbody
      - @documents.each do |document|
        %tr
          %td= document.name
          %td= link_to "Download Document", document.attachment_url
          %td= button_to "Delete",  document, method: :delete, class: "btn btn-danger", confirm: "Are you sure that you wish to delete #{document.name}?"
4

1 に答える 1

1

HAML でルビ文字列補間を使用できます。

%td="#{document.name}, #{time_ago_in_words(document.created_at)}"
于 2015-04-11T21:45:41.017 に答える