I’m having trouble preloading a relationship from a join table through another join table because Ecto seems to be adding another underscore to one of the fields causing preloads to fail. For some reason the id key of the first join table has an additional underscore added to it which ends up querying users__todos_id(note the double underscore after user) instead of user_todos_id which causes preloading to fail. In this instance, instead of users_todos_id from Users_Todos_Tags it seems to be querying users__todos_id(note the extra underscore) wherein it consequently crashes and is unable to find the id.
Can anyone point out what I’m doing wrong or any assumptions Ecto is making? I don’t see a double underscore anywhere in my relationships so I have no idea why the model is failing to load/crashing the query. Does the issue arise because I have a single underscore in the schema name(join table users_todos) already and that somehow conflicts with an implicit relationship?
If it’s any help at all I searched through my entire project(project wide ctrl-f) and the only place users__todos comes up (with the double underscore) is the MyApp.Users_TodosControllerTest which was generated at some point earlier in the project by mix.
Elixir 1.3.4
Ecto 2.0.5
OSX El Capitan
(PostgreSQL) 9.5.5
Attached is the gist of the models/relationships