Skip to content

Instantly share code, notes, and snippets.

@tomlea
Forked from lazyatom/factory_with_callbacks.rb
Created June 11, 2009 16:32
Show Gist options
  • Save tomlea/128034 to your computer and use it in GitHub Desktop.
Save tomlea/128034 to your computer and use it in GitHub Desktop.
# No Boom, it was creating the handle first... cause app Boom
# This does however, as you say, "Boom"
Factory.define :product do |p|
p.product_handles do |p|
[Factory.build(:product_handle)]
end
end
# Only issue here is that the product has knowledge of the handle... knowledge it need not have.
# (I had to add has_many : product_handles to the Product).
# This could however be for the best.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment