Date type in database becomes nil in rails

Hi, there. I wrote an application in Windows and tried to run it in
Ubuntu 10.04 64-bit. The app works fine in windows but I found a
strange problem when I tested it in Ubuntu. Two tables in database have
a column with date type and sqlite3 is able to display the data in the
column. However, as I run it from the browser or rails console, all
data in the column becomes nil. The ROR settings are the same in both
OS except that fact that it’s running sqlite3 3.6.22 in Ubuntu and
3.6.17 in Windows. I wonder if it has something to do with the setting
in Ubuntu. Thank you in advance.

Ichiro

On 2 March 2011 23:24, Ichiro S. [email protected] wrote:

Hi, there. I wrote an application in Windows and tried to run it in
Ubuntu 10.04 64-bit. The app works fine in windows but I found a
strange problem when I tested it in Ubuntu. Two tables in database have
a column with date type and sqlite3 is able to display the data in the
column. However, as I run it from the browser or rails console, all
data in the column becomes nil. The ROR settings are the same in both
OS except that fact that it’s running sqlite3 3.6.22 in Ubuntu and
3.6.17 in Windows. I wonder if it has something to do with the setting
in Ubuntu. Thank you in advance.

I think you will have to give us a lot more information. Post the
section from db/schema.rb for the offending table, post the model.rb
(remove any irrelevant methods you have included, but if you have
included a method with a name like the column that does not work then
include that) and post the result of entering, in the console,
model.first or something similar which should fetch a valid record.

Colin

I think you will have to give us a lot more information. Post the
section from db/schema.rb for the offending table, post the model.rb
(remove any irrelevant methods you have included, but if you have
included a method with a name like the column that does not work then
include that) and post the result of entering, in the console,
model.first or something similar which should fetch a valid record.

Colin

Thanks for your reply, Colin. I found the workaround that’s to change
the type from date to datetime. It’s so strange that even if I created
a new app in Ubuntu with date type in the model, same problem occurred.

Ichiro

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