I am new to Rails and running into problems loading fixtures.  After
generating a bunch of scaffolding, I did a "rake db:migrate", followed
by "rake db:test:load", and then "rake db:fixtures:load".  My goal is
to run the unit tests so that I can verify that everything is at a
good starting point before I do any real development.  I get the
following error:

SQLite3::SQLException: table caches has no column named structure:
INSERT INTO "
caches" ("structure", "capacity") VALUES (NULL, 1)

Can somebody provide a good starting point for troubleshooting this
type of problem?

After a bit of searching, I think these are the three relevant code
snippets that I should be looking at.

Model (cache.rb):
class Cache < ActiveRecord::Base
  belongs_to :structure
end

Schema (schema.rb):
 create_table "caches", :force => true do |t|
    t.integer  "capacity"
    t.integer  "structure_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

Fixture (caches.yml):
one:
  capacity: 1
  structure:

two:
  capacity: 1
  structure:

All of this was generated for me, and it all matches up with what I
expect from documentation.  I know if "belongs_to :structure" was
missing from my model I should expect the error I'm seeing now, so I'm
very suspicious of that being wrong in a subtle way.

Here's the model for structure if it matters (as far as I can tell, it
doesn't):
class Structure < ActiveRecord::Base
  belongs_to :location
end

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to