Multiparameter error

Hello,

What’s the best way to deal with dates prior to 1970 using Rails. I’ve
seen some suggestions for hacks to fallback to the Date class if Time
fails, but I’m not sure exactly how to implement them.

This is from the wiki

require ‘date’

It’s necessary to do this, because Time doesn’t

support dates before 1970…

class ActiveRecord::ConnectionAdapters::Column
def self.string_to_time(string)
return string unless string.is_a?(String)
time_array = ParseDate.parsedate(string)[0…5]
begin
Time.send(Base.default_timezone, *time_array)
rescue
DateTime.new(*time_array) rescue nil
end
end
end

Any help would be appreciated

Jeff

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs