This project is archived and is in readonly mode.

#6495 new
gamov

rake db:fixtures:load doesn't resolve properly label references for associations

Reported by gamov | March 1st, 2011 @ 05:42 PM

When using fixtures with "Label references for associations" (see doc activerecord/lib/active_record/fixtures.rb), the rake command rake db:fixtures:load fails to load the fixtures properly in the database. The DB column name is not translated properly and the field value isn't looked up and the label is put as the value instead of the id of the associated record.

Attached an app with label references in fixtures, just type rake db:fixtures:load and see it fails:

SQLite3::SQLException: table courses has no column named teacher: INSERT INTO "courses" ("subject", "teacher", "created_at", "updated_at", "id") VALUES ('Math', 'toto', '2011-03-01 16:52:15', '2011-03-01 16:52:15', 690422863)

With rails 3.0.5. Works with 2.3.10

Comments and changes to this ticket

  • gamov

    gamov March 2nd, 2011 @ 04:48 AM

    Weirdly, I've created this test application because my big application that I'm migrating to rails 3 couldn't load the fixtures properly; the same way as this test app.
    Today, my big application loads the many fixtures with label references!?!

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Pages