Brasil

Posts com a Tag:

14 junho 2006 ~ Deixe seu comentário »

Globalize time_ago_in_words method of Rails

To localize the distance_of_time_in_words and time_ago_in_words methods of Ruby on Rails with Globalize Plugin, put these lines on your app/helpers/application_helper.rb
[ruby]
def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)
from_time = from_time.to_time if from_time.respond_to?(:to_time)
to_time = to_time.to_time if to_time.respond_to?(:to_time)
distance_in_minutes = (((to_time – from_time).abs)/60).round
distance_in_seconds [...]

Continuar Lendo