我有类似的东西
`@something= @something.each_with_index do |c, i|
@something[i]['created_at']=time_ago_in_words(Time.new(c['created_at'])
`和输出是 - 10个月 但我希望输出为 - 10个月前 任何建议都会有所帮助
答案 0 :(得分:0)
只需添加此
@something= @something.each_with_index do |c, i|
@something[i]['created_at']=time_ago_in_words(Time.new(c['created_at']) + "ago."