I'm trying to use
<%= comment.created_at.time_ago_in_words(from_time) %>
but it wont work. I want the comment to show date as: 3 minutes ago, or 2 days ago.
What is the correct way to use this helper?
In my layout helper:
def time_ago_in_words(from_time, include_seconds_or_options = {})
distance_of_time_in_words(from_time, Time.now, include_seconds_or_options)
end
Thanks!
http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#method-i-time_ago_in_words
so it should be
<%= time_ago_in_words(comment.created_at) %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With