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
-
Obie January 9th, 2008 @ 06:47 AM
- → State changed from new to open
-
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 »
