I have the following factory defined for a 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
the after create block seems to run file and the factory returns the model object with the correct/new changes however this does not persist in my test database.
ie. if i call Page.last.post.user.id
from within my test, i still get the old user id which was assigned to the post object factory earlier before the after create block. I'm not sure why this happens.