Last active
December 20, 2015 01:39
-
-
Save shuhei/6050903 to your computer and use it in GitHub Desktop.
Inconsistency of ActiveRecord Association. Need to reload before `exists?` but not for `size`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@foo = @parent.foos.build(name: 'Foo') | |
@foo.bars.build(greeting: 'hello') | |
@foo.save | |
@foo.bars.exists? # -> nil | |
@foo.bars.size > 0 #-> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment