I was having some issues while testing one of my models. I added a :before_add to a habtm relation, and the filter didn't work due to the foreign key being initialized to zero, instead of NULL. I simply supposed that it should be being initialized with a nil value, but it seems that this depends on the database table schema. Should i use NOT NULL or NULL with foreign keys? I really like the NULL/nil thing when the relation is not yet stablished, but in some cases this is not good since the relation must be present to the model to be valid. But we have the :dependent clause. Thanks, Rodrigo.
on 2005-12-05 10:39