开发者

problem converting time

开发者 https://www.devze.com 2023-02-27 02:57 出处:网络
i have a post and i need to display how long ago it was posted. When i do this <%= time_ago_in_words(Time.now - post.created_at) %>

i have a post and i need to display how long ago it was posted.

When i do this

 <%= time_ago_in_words(Time.now - post.created_at) %>

i get the following error

undefined method `abs' for 2011-04-17 17:16:11 +开发者_如何学Python0300:Time

I think the app can't convert the time correctly . How can i repair this problem ?


You have got wrong syntax

<%= time_ago_in_words(post.created_at) %>
0

精彩评论

暂无评论...
验证码 换一张
取 消