开发者

Why are the date fields in my rails object / model evaluating to nil when I can clearly see that they are not?

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"=>"", "begind开发者_C百科ate"=>"2010-10-12", "id"=>"95", "region_id"=>"1", "active"=>"1"}> 

pp.enddate => nil

Is this a mysql issue?


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜