Thursday, April 21, 2011

Rails 2 + SQLite 3 - can ID field be zero?

My problem: I'm writing a flex frontend to a rails app, and I'm having problems in managing NULL database values.. so to avoid problems I just don't allow NULL.

Now, for foreign keys, would 0 be fine? No chance that a record be assigned ID 0, right? Maybe I could somehow tell rails to skip foreign key updates if input is 0..

From stackoverflow
  • If there's no matching row with a foreign key value of 0, it should work fine, because then there's nothing to update.

0 comments:

Post a Comment