Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 2ef76cb

Browse files
author
Nick Gauthier
committed
added fk validation dodge example
1 parent d967524 commit 2ef76cb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

chapter-2/01-fks.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Comment.belongs_to Post
2+
3+
p = Post.new
4+
c = Comment.new(:post => p)
5+
p.destroy
6+
=> true
7+
c.reload; c.valid?
8+
=> false
9+
# but it's in the DB!

0 commit comments

Comments
 (0)