Forum: Ruby on Rails Fixtures, HABTM and id values

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2009-05-11 23:15
(Received via mailing list)
I have models Frog and Froglet with HABTM relationship between them.
In the fixtures file for froglets I can say
  frogs:  frog1, frog2, frog3
where frog1 etc are the names in the frog fixture, and the join table is
magically created for me.
This works fine provided the fixtures do not explicitly include id
values
for the frog and froglet records.

Unfortunately I have legacy code that requires that I explicitly specify
the
ids in the frog and froglet fixtures.  Is there anyway that I can
specify
something like:
frogs: 1, 2, 3
where 1, 2, 3 are the id values obviously. I tried this but the join
table
was not correct.

Colin
This topic is locked and can not be replied to.