Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[PATCH] Generate fixture data for empty models

#3563

In Agile Web Development with Rails, Edition Four, I'm intending to define a Cart model thus:

class Cart < ActiveRecord::Base
  has_many :line_items, :dependent=>:destroy
end

So I start off easily enough:

ruby script/generate scaffold cart

This generates both a test/functional/carts_controller_test.rb and a test/fixtures/carts.yml. Unfortunately, the generated tests will not pass as generated as there are no fixtures name one and two, nor is there even an indication of what needs to be done in the fixture itself.

I figured I could explain this in the book, or I could simply provide a patch to eliminate the need to explain this, and hence the patch.

Reported by Sam Ruby · December 11th, 2009 @ 06:37 PM

State: committed
Milestone: 3.0.2
Assigned to: nobody
Importance: Low