The Rails learning project continues. I’ve got an actual application to work on, one that will be useful when it’s done: a web-based version of our expense tracking application. The old one was done in Access and has served us well over many years. But file sharing has always been a pain since we often have different OS versions (and now different OSes) on our two computers, and can’t be bothered with hooking up external hard drives etc. So we want a solution that we can both access more easily. Thus, web, and Rails.
It’s fun and educational but it is also painful. The trivial tasks are trivial, but the moment I try to do something other than plain CRUD with strings and numbers, I get stuck. Every task takes me a whole evening. At this rate the application won’t be done until Christmas.
Today’s stuckness: time zones. I want to be able to migrate the data from our existing database, and CSV files seemed like a sensible medium. Exporting from Access to CSV went easily. Importing text went well enough, once I figured out that I needed to open and resave the file with different encoding. But importing dates did not. My data file had an entry for 1998-01-01 and after importing it somehow became 1997-12-31 23:00. When I got that fixed (by changing the application’s time zone to UTC) the data looked right but whenever I re-imported the data file, the dates were not recognized as matching what was already in the database, so the records were appended rather than updated. It turns out that in SQLite a date without time is not the same as a datetime with time = 0. Who comes up with this stuff?
Leave a comment