views:

19

answers:

2

I'm using ruby 1.8.6 and rails 1.2.3 (ancient but I'm debugging an old app)

A model called Payperiod has attributes begindate and enddate and after importing the db, the dates are all there (apparently)

But in the console and in the app, the date attributes eval to nil. Why?

Below is some code pasted from the console:

pp = Payperiod.find 95

=> #<Payperiod:0xb6d60f90 @attributes={"enddate"=>"2010-10-25", "title"=>"", "begindate"=>"2010-10-12", "id"=>"95", "region_id"=>"1", "active"=>"1"}> 

pp.enddate => nil

Is this a mysql issue?

A: 

It's worth checking whether there are methods defined with the same names as the attributes which would override the default active record behaviour.

Shadwell
No, that isn't the case here. good idea though.
Phil
Ok here is an update: all my models that have date fields eval to nil. But every other attribute is intact.
Phil
But I can assign a "new" date to the attribute of the model. like this: pp.enddate = Time.now
Phil
A: 

This isn't really an "answer" because I don't have specific info, but when I installed ruby 1.8.7 instead of 1.8.6, the problem vanished.

Phil

Phil