diff --git a/lib/application.js b/lib/application.js index 98d9c69b84..15e4db16e2 100644 --- a/lib/application.js +++ b/lib/application.js @@ -550,7 +550,7 @@ app.render = function(name, options, fn){ } if (!view.path) { - view.lookupMain(function (err) { + view.lookupMain(opts, function (err) { if (err) return fn(err); afterLookup(); diff --git a/lib/view.js b/lib/view.js index 6d07fcadea..3ac81a09c6 100644 --- a/lib/view.js +++ b/lib/view.js @@ -59,11 +59,13 @@ function View(name, options) { * @api private */ -View.prototype.lookup = function lookup(name, ext, cb) { +View.prototype.lookup = function lookup(name, options, cb) { var roots = [].concat(this.root); debug('lookup "%s"', name); + var ext = path.extname(name); + function lookup(roots, callback) { var root = roots.shift(); if (!root) { @@ -111,13 +113,13 @@ View.prototype.render = function render(options, fn) { * @param {function} cb * @private */ -View.prototype.lookupMain = function lookupMain(cb) { +View.prototype.lookupMain = function lookupMain(opts, cb) { if (this.path) return cb(); var view = this; var name = path.extname(this.name) == this.ext ? this.name : this.name + this.ext; - this.lookup(name, this.ext, function (err, path) { + this.lookup(name, opts, function (err, path) { if (err) { return cb(err); } else if (!path) {