Comments
-
Greg Hurrell
Status changed:
- From: New
- To: Open
-
Greg Hurrell
FixtureReplacement 3.0 handles this, as noted here, so looks like the problem might go away.
-
Greg Hurrell
Factory Girl also handles it without a problem:
Factory.define :email do |e| e.address { Sham.email_address } e.association :user e.verified true end Factory.define :user do |u| u.display_name { Sham.user_display_name } u.passphrase { Sham.passphrase } u.passphrase_confirmation { Sham.passphrase } u.verified true # an associated email is not "required" (for validation) but it # is still necessary in practice if the record is to be usable u.after_create { |user| Email.make! :user => user } end
Calling
Email.make
/Email.make!
always creates the associated user object.And as noted in the comment
User.make
won't try to make an associated email, butUser.make!
will set one up via theafter_create
callback.Works very nicely, so marking as closed.
-
Greg Hurrell
Status changed:
- From: open
- To: closed
Add a comment
Comments are now closed for this issue.