What module(s) do I need to include to get 5.seconds to work in Ruby?

aarona picture aarona · May 21, 2010 · Viewed 10.4k times · Source

Because apparently require 'date' doesn't include the method hours or seconds etc:

undefined method `hours' for 5:Fixnum (NoMethodError)

Am I missing something? Is 5.seconds only something you can do in Rails? If so, what is the require statement I need to get this to work in a ruby script?

Answer

Lou Zell picture Lou Zell · Feb 6, 2013

Old question, but for the googlers like me:

require 'active_support/time'

For gem version 3.2.11, anyway.