Skip to content

Instantly share code, notes, and snippets.

@wordswords
Created June 10, 2016 20:37
Show Gist options
  • Save wordswords/2fbd8c8808e15cc3643cccdb3369eec9 to your computer and use it in GitHub Desktop.
Save wordswords/2fbd8c8808e15cc3643cccdb3369eec9 to your computer and use it in GitHub Desktop.
require 'action_view'
include ActionView::Helpers::DateHelper
require 'date'
starttime = DateTime.new(2014, 6, 2, 6, 6, 6)
endtime = DateTime.new(2016, 6, 2, 1, 1, 1)
wordy_time = ActionView::Helpers::DateHelper.distance_of_time_in_words(starttime, endtime)
# david@David-Craddocks-MBP ~/w/bug-in-action-view> bundle exec ruby bug_in_action_view.rb
#/Users/david/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionview-4.2.6/lib/action_view/helpers/date_helper.rb:111:in `block in distance_of_time_in_words': undefined method `acts_like?' for 2014-06-02 07:06:06 +0100:Time (NoMethodError)
# from /Users/david/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/core_ext/object/with_options.rb:67:in `call'
# from /Users/david/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/core_ext/object/with_options.rb:67:in `with_options'
# from /Users/david/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionview-4.2.6/lib/action_view/helpers/date_helper.rb:82:in `distance_of_time_in_words'
# from bug_in_action_view.rb:6:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment