#100 open
Rick DeNatale

P 557 et. seq. - Dynamic Fixture Data somewhat obsolete

Reported by Rick DeNatale | January 9th, 2008 @ 06:43 AM | in Second Edition

Rails 2.0 no longer requires the id to be specified if it is omitted a value will be generated automatically.

Also in Rails 2.0, foreign keys to other tables can be specified in fixtures by name, even better than the fixtures_references plugin discussed on p 561.

This even extends to habtm relationships:

class X < ActiveRecord::Base

has_and_belongs_to_many :ys

end

class Y < ActiveRecord::Base

has_and_belongs_to_many :xs

end

test(or spec)/fixtures/x.yaml

fred:

y: ethel

test(or spec)/fixtures/y.yaml

ethel:

x: fred

and the join table will be automatically populated.

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

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

People watching this ticket