0

hamlc を使用して、バックボーン テンプレートで time_ago_in_words などの Rails 標準メソッドを使用する方法はありますか? これを試したところ

.created_at= time_ago_in_words e.created_at

例外をスローします

Uncaught ReferenceError: time_ago_in_words is not defined
4

1 に答える 1

0
    I had to create this simple method and return to the template. 

     include ActionView::Helpers::DateHelper
     def personalize_time(c)
          coll = []
          c.each do |v|
            coll << {"created_at" => time_ago_in_words(v['created_at']), "collection" => v}         
          end
          coll
     end
于 2015-10-30T19:33:32.250 に答える