Skip to content

Commit

Permalink
refactor res.render() to prevent clobbering "locals"
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Aug 11, 2012
1 parent ff1c6f0 commit 6bebe08
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/application.js
Expand Up @@ -467,8 +467,8 @@ app.render = function(name, options, fn){
// merge app.locals
utils.merge(opts, this.locals);

// merge options.locals
if (options.locals) utils.merge(opts, options.locals);
// merge options._locals
if (options._locals) utils.merge(opts, options._locals);

// merge options
utils.merge(opts, options);
Expand Down
2 changes: 1 addition & 1 deletion lib/response.js
Expand Up @@ -665,7 +665,7 @@ res.render = function(view, options, fn){
}

// merge res.locals
options.locals = self.locals;
options._locals = self.locals;

// default callback to respond
fn = fn || function(err, str){
Expand Down

0 comments on commit 6bebe08

Please sign in to comment.