Skip to content
This repository has been archived by the owner on Oct 9, 2019. It is now read-only.

Resolve the model path before requiring models #11

Merged
merged 1 commit into from
Mar 16, 2015

Conversation

jacobwgillespie
Copy link
Contributor

If your model path is ./models in options.models, then path.join will strip the leading ., leading to errors when the require is no longer relative (like Error: Cannot find module 'models/user.js').

This PR fixes this by calling path.resolve before calling require to turn relative paths into absolute ones.

Here's a related link: http://stackoverflow.com/questions/23096963/node-js-path-join-removes-leading-period

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 4d148b3 on playlist-forks:fix-relative-require into 7c4814d on lob:master.

pon added a commit that referenced this pull request Mar 16, 2015
Resolve the model path before requiring models
@pon pon merged commit 44f6bdb into lob:master Mar 16, 2015
@jacobwgillespie
Copy link
Contributor Author

Thanks! 👍

@jacobwgillespie jacobwgillespie deleted the fix-relative-require branch March 16, 2015 20:07
@pon
Copy link
Contributor

pon commented Mar 16, 2015

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
3 participants