Forum: Ruby on Rails distance_of_time_in_words_to_now with "ago" suffix

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D5e95369c4366d0ccd6a21828ca11c79?d=identicon&s=25 Brendon Gleeson (Guest)
on 2006-02-01 10:52
(Received via mailing list)
I wanted the distance_of_time_in_words_to_now method to have ' ago'
suffixed to it when the date is in the past, I assumed this would be the
default behaviour but apparently not. I know of a REALLY messy way that
i could solve this with, but it's so ugly I can't be bothered

Does anybody have an easy, elegant solution?
3dd4b52a0946bd698b1d1635a46ea3a3?d=identicon&s=25 Francois Beausoleil (Guest)
on 2006-02-01 15:17
(Received via mailing list)
Hi !

2006/2/1, Brendon Gleeson <brendon@gleesonprop.co.za>:
> I wanted the distance_of_time_in_words_to_now method to have ' ago'
> suffixed to it when the date is in the past, I assumed this would be the
> default behaviour but apparently not. I know of a REALLY messy way that
> i could solve this with, but it's so ugly I can't be bothered
>
> Does anybody have an easy, elegant solution?

<p><%= distance_of_time_in_word_to_now(@created_at) %> ago</p>

Isn't that what you want ?

Hope that helps !
This topic is locked and can not be replied to.