Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix wolfpack model require #4

Merged
merged 1 commit into from
May 12, 2014
Merged

fix wolfpack model require #4

merged 1 commit into from
May 12, 2014

Conversation

nlt2390
Copy link
Contributor

@nlt2390 nlt2390 commented May 8, 2014

When I create a file "test.js" in my root project folder (using Sails) with following content:

var wolfpack = require('wolfpack'),
      myModel = wolfpack('/api/models/MyModel');

WolfPack cannot find MyModel file because it expects that file in wolfpack\lib\node_modules\api\models\MyModel

try {
      model = require(model_path);
    }

process.cwd() will get the current require function caller, make wolfpack search the right dir.

@fdvj
Copy link
Owner

fdvj commented May 8, 2014

We could however, to improve functionality do a two-way check. If wolfpack cannot find the file in the process path + path given, it should fallback and check if the path given is found, otherwise throw.

@nlt2390
Copy link
Contributor Author

nlt2390 commented May 9, 2014

Yes I think you should add a check or add a Sails project example with wolfpack, that "require path" really confuses me at the first time using. :)

@fdvj fdvj self-assigned this May 9, 2014
fdvj added a commit that referenced this pull request May 12, 2014
@fdvj fdvj merged commit 9e268db into fdvj:master May 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants