Simple test case:
require ‘rubygems’
require ‘active_support’
puts 5.years.ago
puts 40.years.ago
It seems to be an issue on windows, as the linux version of the test
below works just fine, but windows will crash with an ArgumentError:
time must be positive.
Does anyone have a solution/workaround so that I can create database
queries that search for users older than 35 on my windows test box?
Thank you.
[email protected] wrote:
Does anyone have a solution/workaround so that I can create database
queries that search for users older than 35 on my windows test box?
Thank you.
The ‘ruby-units’ gem can handle datetime math like this and will
automagically convert to a DateTime from a Time when necessary.
Using ruby-units, you would use
‘40 years’.ago
_Kevin
puts Time.year.now-40
puts Time.year.now-80
it is another solution if u dont want upgrade your rails.
Y Reinhart AP
Teapoci.Blogspot.com