Added comment to a guide about necessity of `:dependent` option for asso... #11852

Merged
merged 1 commit into from Aug 12, 2013

2 participants

@VorontsovIE

...ciations with NOT NULL constraint

@steveklabnik steveklabnik commented on an outdated diff Aug 12, 2013
guides/source/association_basics.md
@@ -1137,6 +1137,8 @@ Controls what happens to the associated object when its owner is destroyed:
* `:restrict_with_exception` causes an exception to be raised if there is an associated record
* `:restrict_with_error` causes an error to be added to the owner if there is an associated object
+It's necessary not to set or leave `:nullify` option for those associations that have `NOT NULL` database constraints. If you don't set `dependent` to destroy such associations you won't be able to change associated object because initial associated object foreign key will be set to unallowed `NULL` value.
@steveklabnik
Ruby on Rails member
steveklabnik added a line comment Aug 12, 2013

"to change the associated object"

Also, 80 cols would be nice, I know the rest of the file isn't there yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@VorontsovIE

@steveklabnik Thank you for comments. Sent fixed version

@steveklabnik steveklabnik merged commit 4d1e584 into rails:master Aug 12, 2013
@steveklabnik
Ruby on Rails member

Thank you!

@VorontsovIE VorontsovIE deleted the VorontsovIE:guide_addition branch Aug 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment