想要将time_ago_in_words的结果显示为“几天前”

时间:2013-10-29 07:32:02

标签: ruby-on-rails timestamp


   我有类似的东西

   `@something= @something.each_with_index do |c, i|
    @something[i]['created_at']=time_ago_in_words(Time.new(c['created_at'])    

`和输出是 - 10个月     但我希望输出为 - 10个月前     任何建议都会有所帮助

1 个答案:

答案 0 :(得分:0)

只需添加此

@something= @something.each_with_index do |c, i|
@something[i]['created_at']=time_ago_in_words(Time.new(c['created_at']) + "ago."