Permalink
Browse files

Fixed view hints

populate attempts on new View
  • Loading branch information...
1 parent 385a05d commit ae1078944c11627456fb99aeda2106c809185d16 @tj tj committed Apr 27, 2011
Showing with 7 additions and 5 deletions.
  1. +6 −5 lib/view.js
  2. +1 −0 lib/view/view.js
View
@@ -277,6 +277,9 @@ res._render = function(view, opts, fn, parent, sub){
// status support
if (options.status) this.statusCode = options.status;
+ // capture attempts
+ options.attempts = [];
+
var partial = options.renderPartial
, layout = options.layout;
@@ -403,10 +406,8 @@ res._render = function(view, opts, fn, parent, sub){
function hintAtViewPaths(view, options) {
console.error();
console.error('failed to locate view "' + view.view + '", tried:');
- console.error(' - ' + new View(view.path, options).path);
- console.error(' - ' + new View(view.prefixPath, options).path);
- console.error(' - ' + new View(view.indexPath, options).path);
- if (!options.isLayout) console.error(' - ' + new View(view.upIndexPath, options).path);
- if (options.isLayout) console.error(' - ' + new View(view.rootPath, options).path);
+ options.attempts.forEach(function(path){
+ console.error(' - %s', path);
+ });
console.error();
}
View
@@ -49,6 +49,7 @@ function View(view, options) {
this.name = this.basename.replace(this.extension, '');
this.path = this.resolvePath();
this.dirname = dirname(this.path);
+ options.attempts.push(this.path);
};
/**

0 comments on commit ae10789

Please sign in to comment.