9
I am converting some Rails controller code to be generic Ruby code. I came across this:
expiration_date = 1.hours.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z')
...and realized this is not standard Ruby. I get this error message:
undefined method `hours' for 1:Fixnum (NoMethodError)
How can I convert this to standard Ruby, or require/include the necessary libraries to make this work?
Solution:
Require the ActiveSupport Numeric class extensions:
require 'rubygems'
require 'active_support/core_ext/numeric/time'