Forum: Ruby on Rails Error in AWDR book: page 176

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Af95bdaf87958c40150b813e94381bfd?d=identicon&s=25 Christer Nilsson (Guest)
on 2005-11-20 21:27
This is a performance test adding 100 orders, and one lineitem. In
teardown, when deleting the first order, the lineitem can't be deleted
as it is referenced by 99 other orders. (One order has many lineitems).
So test_save_bulk_orders fails.

My suggestion is to change teardown:

def teardown
  LineItem.delete_all
  Order.delete_all
end

or adding one lineitem per order in the fixture.
This topic is locked and can not be replied to.