#100 ✓resolved
Rick DeNatale

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

Reported by Rick DeNatale | January 9th, 2008 @ 11:43 AM | in The Rails 3 Way

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 Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

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

Shared Ticket Bins

Pages