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
that it should be being initialized with a nil value, but it seems that
depends on the database table schema.
Should i use NOT NULL or NULL with foreign keys? I really like the
thing when the relation is not yet stablished, but in some cases this is
good since the relation must be present to the model to be valid. But we
have the :dependent clause.