Forum: Ruby on Rails Relation null or zero?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
papipo (Guest)
on 2005-12-05 11:39
(Received via mailing list)
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.

This topic is locked and can not be replied to.