Open sometea opened 8 years ago
This fixes some of my model loading issues where before I had to move var Model
declarations inside my express controller instead of defining them at the top of the file
edit: nvm
I don't think that actually fixes that issue. That issue is just a matter of the order that modules load. If you load Module B before Module A, and B uses the model from A you'll get that error.
However, I'd have to dig a bit deeper into this. But my initial guess is that this is trying to add an 's' to 'model' when it's passed in as a type. This code looks like it's related to finding specific folders (Models and Routes) to process specially. Might be better to see if "model" is being passed and maybe change it to "models".
Though the error would possibly also occur if a folder was then named "models".
Again this is just from a cursory look, but I don't think it solves the larger problem of reserved words in a path. If someone knows that system better and can correct me that'd be appreciated.
As described in #94, if the path of the app has the substring "model" in it, the app crashes. This was because when loading mean.io modules, the code walking through the directory and loading the modules just checked the type by searching for the substring in the path, causing controllers to be loaded before the modules. This PR fixes the issue by changing the way the type is checked.
See also linnovate/mean#1283