Ruby on rails 3 关于工厂女工的问题

Ruby on rails 3 关于工厂女工的问题,ruby-on-rails-3,factory-bot,Ruby On Rails 3,Factory Bot,我在阅读时遇到了这个代码块 #The behavior of the association method varies depending on the build strategy used for the parent object. #Builds and saves a User and a Post post = FactoryGirl.create(:post) post.new_record? # => false post.author.new_record

我在阅读时遇到了这个代码块

#The behavior of the association method varies depending on the build strategy used for the parent object.

#Builds and saves a User and a Post
post = FactoryGirl.create(:post)
post.new_record?       # => false
post.author.new_record # => false

# Builds and saves a User, and then builds but does not save a Post
post = FactoryGirl.build(:post)
post.new_record?       # => true
post.author.new_record # => false
我对Factory Girl还不熟悉,但对于new_record,第一个代码示例不应该返回true吗?我很困惑,如果帖子被构建并保存,为什么会返回false

新记录?()公开
如果此对象尚未保存,则返回true-即,该对象的记录尚不存在;否则,返回false。
最新稳定版本的Rails不推荐使用此方法

编辑:
哎呀,链接好像断了。固定的。

啊。我懂了。这是一个相当混乱的术语,所以我很高兴它被弃用了。我想他们还没来得及更新文档。