cherry picked commit from https://github.com/PaulAvery/sails/commit/415e15164c4fc89695d492b02dbe63a82fe11348
Fix this to work if no layout or partials are defined. Also, require path