I have the following factory defined for the model:
factory :page do association :user, factory: :standard_user association :post, factory: [:short_post] after :create do |model| model.post.user = model.user model.save! end end
after creating the block, the file seems to be launched, and the factory returns the model object with the correct / new changes, however this is not saved in my test database.
that is, if I call Page.last.post.user.id from my test, I still get the old user ID that was assigned to the post factory object before the block after creation. I am not sure why this is happening.
source share