Trouble with Date class


#1

I’m having trouble with Ruby’s Date class. I’m trying to do something
as simple as “Date.today” but I keep getting errors.

I’ve included “require ‘date’” to environment.rb but still no luck.

Am I doing something wrong?

Thanks,
-Andrew


#2

What’s your Ruby version ?
C:\ruby\dev\buildview>ruby -v
ruby 1.8.2 (2004-12-25) [i386-mswin32]

What’s the error ?
C:\ruby\dev\buildview>irb
irb(main):001:0> Date.today
NameError: uninitialized constant Date
from (irb):1
irb(main):002:0> require ‘date’
=> true
irb(main):003:0> Date.today
=> #<Date: 4907419/2,0,2299161>

On 12/4/05, Andrew G. removed_email_address@domain.invalid wrote:


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


#3

Ruby version: ruby 1.8.2 (2004-12-25) [powerpc-darwin7.8.0]

I was able to duplicate what you showed in irb:
irb(main):001:0> Date.today
NameError: uninitialized constant Date
from (irb):1
irb(main):002:0> require ‘date’
=> true
irb(main):003:0> Date.today
=> #<Date: 4907419/2,0,2299161>
irb(main):004:0>

But when I try running my rails app I get the error: “undefined method
`today’ for #<Date: -1/2,0,2299161>”

-Andrew


#4

On 12/5/05, Andrew G. removed_email_address@domain.invalid wrote:

=> #<Date: 4907419/2,0,2299161>

Show your code and error/trace for more help.