thoughtbot/factory_girl — pull request #323 by arehberg (2012-03-22 22:04:27+00:00)
Title: Added a before_create callback

I'm working on a project where I need models built with Factory.create to have a property set differently than Factory.build (and needed it saved as well), and since after_build gets called before after_create the only way I could change the property back was by calling after_create with an additional call to the model's save method. There's a very long inheritance chain involved, so all those extra DB hits added up.

I needed a quick fix so I didn't modify any of the acceptance tests, but I wrote a few specs.

I know it's nothing huge, but maybe someone else in my situation will find it useful :)