Rails FactoryGirl trait association with model after_create callback not setting vanity_url
问题 In my model, I have an after_create callback that triggers the method: class Job < ActiveRecord::Base after_create :update_vanity_url private def update_vanity_url self.vanity_url = '/jobs/' + company.slug + '/' + slug + '/' + id.to_s + '/' end end This sets up a custom url for my jobs, however, when I try to use this in my coupon factory it is not being saved. The coupon is created without a job assigned. Only when the coupon is used is it paired with one job. I referred to that as executed: