Reputation: 25
I'm using distance_of_time_in_words
with rails 4 on created_at attribute but it doesn't works
in my view:
<% @posts.each do |post| %>
....
<td><%= distance_of_time_in_words(post.created_at, post.created_at + 30.days) %></td>
it show always:
about 1 month
If I use time_ago_in_words it works
Upvotes: 0
Views: 210
Reputation: 11007
let's say post.created_at
is sept 01.
sept 1, sept 1 + 30 days
is about one month. If you always have post.created_at, post.created_at + 30.days
then it's always going to return about one month
because that's the amount of time you're giving it.
Upvotes: 2