Hey! I've bundled this approach into a component: https://github.com/doublemarked/loopback-component-model-fragments
This boot script will load module components on app initialization. Stick this file in server/boot. Components are looked for in the directory common/models/model-name. The script will load recursively any script from that directory, passing it the Model handle as a parameter (just like model.js loads). Conveniently, since this is occuring during the boot phase, those model scripts will execute at a later phase than model.js, meaning PersistedModel is already initialized and all peer model handles are already usable. Note - it's necessary for you to still maintain a model.js file for Loopback to load the model at all.
AUTHOR: Heath Morrison | @govright.org | http://github.com/doublemarked
QUESTIONS? Write me or join us on Gitter: https://gitter.im/strongloop/loopback
ReferenceError: appRoot is not defined
Where should appRoot be defined?