[Rails] distance_of_time_in_words_to_now with "ago" suffix

Francois Beausoleil francois.beausoleil at gmail.com
Wed Feb 1 14:15:44 GMT 2006


Hi !

2006/2/1, Brendon Gleeson <brendon at 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 !
--
François Beausoleil
http://blog.teksol.info/


More information about the Rails mailing list