Forum: Ruby on Rails Date.new exception in controller

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sven A. Schmidt (Guest)
on 2007-04-27 12:18
(Received via mailing list)
Hi all,

I'm fairly new to rails and probably doing something stupid here.
Unfortunately, I can't come up with a good search term to help solve
the problem -- I hope someone here can help :)

I'm getting an "invalid date" exception when I call, say,

t1 = Date.new( 2007, 4, 27 )

in my controller class. I'm puzzled by this, because both in irb but
also in script/console (same project) this works fine. I've tried
Date.parse, Date.civil -- they all lead to the same error (because
they ultimately call the same problematic method).

Does anyone know why this doesn't work in the controller? I'm using
Locomotive 2.0.8 on OSX, which corresponds to ruby 1.8.6 and rails
1.2.3. The "invalid date" exception is raised in "new!" at

lib/ruby/1.8/date.rb:727:in `new!'
lib/ruby/1.8/date.rb:729:in `new'

Looking at the code in date.rb doesn't ring any bells, either. One
thing I noted was that during my attempts to solve this problem I also
got

lib/ruby/1.8/date.rb:727:in `new!'
lib/ruby/1.8/Date.rb:729:in `new'

at some point. Note the capital 'D'. Now, this might be significant,
because HFS+, the OSX file system, is case-insensitive (but case-
preserving). Could there be a problem with file name clashes or is
this merely cosmetic?

Any input greatly appreciated,
Sven
This topic is locked and can not be replied to.