2.0 Fixtures with has_many :through ??

hi!

did anyone get the new fixtures features (no join table, no ids) for a has_many :through assocation running?

I did everything like I saw in a couple of screencasts and tutorials, but they were all using a habtm association - what do I have to change to get it to work with a has_many :through?

google didn't brought any results and a question in the rails forum by someone else with the same problem was not answered by anyone - is it possible that the new fixtures simply cannot be used with a has_many :through currently? and if so, does anyone know if it is planned to have it in the rails core in the next future?

thanks for any feedback!!

philipp

This is not currently supported as far as I know but there is a very good reason why. First off, the general use case for has_many :through is when you need to join two models AND include additional details about the association. For instance if we have users and magazines then the through association would be "subscription" BUT it also has other attributes such as when the subscription was made and how many times recurring payment has been received.

How would you specify the additional columns of information for the relationship using the new fixtures method? The new way is just a list of fixture names and would not be able to accommodate has many through relationships that contained additional data.

I could imagine a syntax that could work but it would different. Not to mention that in a has_many :through, the join table itself is a model and so having fixtures for it somehow makes sense since it is actually an activerecord model itself.

I think the answer is not "It cannot be done for good reasons" but "It can be done but it takes two steps." Since you've taken the time to declare the join table explicitly as a model that only makes sense.