Now if there was just a built-in way to have something like :dependent
=> :deny we'd be set.
By the way, what is the best way to support the "deny delete"
association rule. Just to clarify this is saying "Deny deletion of the
parent object if it has one or more children." This rule is often
useful to ensure referential integrity.
Scenario 1: An admin creates a new product with item number 1010. It
is realized later that the item will never be sold. Since no orders of
the product exist in the system it's fine to delete the item.
Scenario 2: It is discovered that an existing product with item number
1001 is no longer available to be sold. The admin attempts to delete
the existing product, but there are outstanding orders containing
product 1001. It's not good to use either :dependent => :destroy
nor :dependent => :nullify in this scenario. You can't simply let the
system automatically delete all orders containing product 1001. You
must first resolve the orders (child objects) before deleting the
Does Rails have built-in support for this common referential integrity