Fix(crud) include param lookup now works w/plurals #26

Merged
joeybaker merged 3 commits from fix-include into master 2016-10-26 18:42:15 +00:00
Showing only changes of commit 83eadf0929 - Show all commits

View File

@ -36,7 +36,6 @@ const register = (server, options = {}, next) => {
// Join tables
if (model.options.name.singular !== model.name) continue;
crud(server, model, options);
for (const key of Object.keys(model.associations)) {
const association = model.associations[key];
@ -92,6 +91,13 @@ const register = (server, options = {}, next) => {
}
}
// build the methods for each model now that we've defined all the
// associations
Object.keys(models).forEach((modelName) => {
const model = models[modelName];
crud(server, model, options);
});
next();
};