Closed caasjj closed 10 years ago
Did you check out https://github.com/bredikhin/barrels/issues/12#issuecomment-60329812?
Thanks for the follow up, and though I did look through the list of existing issues, I completely missed that exchange - sorry, my bad.
Manually associating models seems not to be possible to do reliably. In the following example, different passports get associated to users on multiple startups of the server.
I have two models I'm trying to populate. One is a
User
model, the other aPassport
model, where aUser
has manyPassports
. So, I try to initialize them as follows:User
:and
Passport
:The code to populate the database is as follows:
I can see in the database that sometimes 'admin' user gets 'demo' passport, and in fact i can login to 'admin' account with 'demodemo' password.
I'm disabling auto-association because I have models with
required:true
on associations, and this causes barrels to fail to load models.