aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-10-19 18:35:44 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-10-19 18:35:44 -0300
commitc50de96200da6a507c96891f2517aa6b69d10d18 (patch)
tree5c46e3bbda158b6e73a30267c4bf2cbf74aa650d /actionpack/lib
parent86df55e783fb0d04e45bba33c3e37942538dfca8 (diff)
parente22e78545112eaad857ab1e02119e20ce10065d0 (diff)
downloadrails-c50de96200da6a507c96891f2517aa6b69d10d18.tar.gz
rails-c50de96200da6a507c96891f2517aa6b69d10d18.tar.bz2
rails-c50de96200da6a507c96891f2517aa6b69d10d18.zip
Merge pull request #7997 from steveklabnik/issue_733
Add i18n scope to disance_of_time_in_words.
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/helpers/date_helper.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb
index 5464437e42..f43d20c6ed 100644
--- a/actionpack/lib/action_view/helpers/date_helper.rb
+++ b/actionpack/lib/action_view/helpers/date_helper.rb
@@ -73,13 +73,17 @@ module ActionView
options[:include_seconds] ||= !!include_seconds_or_options
end
+ options = {
+ scope: :'datetime.distance_in_words'
+ }.merge!(options)
+
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)
from_time, to_time = to_time, from_time if from_time > to_time
distance_in_minutes = ((to_time - from_time)/60.0).round
distance_in_seconds = (to_time - from_time).round
- I18n.with_options :locale => options[:locale], :scope => :'datetime.distance_in_words' do |locale|
+ I18n.with_options :locale => options[:locale], :scope => options[:scope] do |locale|
case distance_in_minutes
when 0..1
return distance_in_minutes == 0 ?