views:

56

answers:

2

Code:

<%="#{time_ago_in_words(comment.created_at)} ago "%>

What i'd like is for it not to have "ABOUT" in front of the 2 hours ago, which shows up for hours but not for minutes...

Is there another function or a way to remove it without finding and replacing?

+1  A: 

You can use my dotiw gem/plugin for that. It adds a couple of additional options and has greater precision than the one Rails offers.

distance_of_time_in_words(time1, time2, :only => [:days, :hours, :minutes])
Ryan Bigg
thxs, but I like the lack of precision for the app I'm building.. It's more about removing the word "about" make sense?
AnApprentice
@TheApprentice, well in that case use the `:vague` option in dotiw.
Ryan Bigg
+5  A: 

You can change this via your I18n locale file. In config/locales/en.yml...

"en":
  datetime:
    distance_in_words:
      about_x_hours:
        # The defaults are "about 1 hour" and "about %{count} hours"
        one: "1 hour"
        other: "%{count} hours"

See the default locale file in actionpack for a complete reference.

Dave Pirotte