Skip to content

Instantly share code, notes, and snippets.

@mattmcmanus
Created March 11, 2011 21:53
Show Gist options
  • Save mattmcmanus/866645 to your computer and use it in GitHub Desktop.
Save mattmcmanus/866645 to your computer and use it in GitHub Desktop.
An issues I'm running into w/ node, exporess, jade and mongoose
...
h2 Services to monitor
ul.services
!=partial('_form_service', server.services)
li
a(href='javascript:void(0)') Add Another
li
ul
li.name
label(for='server[services]['+indexInCollection +'][name]') Name
input(type="text", name='server[services]['+indexInCollection +'][name]', value=service.name)
...
header
h1 Edit #{server.hostname}
form.server.edit(method='post',action='/server/'+server.id)
input(type='hidden', name='_method', value='put')
input(name='server[id]', value=server.id, type='hidden')
!=partial('_form')
ul
li.buttons
input.button(type="submit", value="Save Changes")
a.button.cancel(href="/") Cancel
a.button.delete(href="/server/"+server.id+"/delete") Delete Server
ReferenceError: Jade:5
3. ' li.name'
4. ' label(for=\'server[services]['+indexInCollection +'][name]') Name'
5. ' input(type="text", name=\'server[services]['+indexInCollection +'][name]', value=service.name)'
service is not defined
at Object.anonymous (eval at <anonymous> (/usr/local/lib/node/.npm/jade/0.8.5/package/lib/jade.js:227:10))
at ServerResponse.render (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:287:24)
at render (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:93:16)
at renderPartial (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:109:14)
at Object.partial (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:270:12)
at Object.anonymous (eval at <anonymous> (/usr/local/lib/node/.npm/jade/0.8.5/package/lib/jade.js:227:10))
at ServerResponse.render (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:287:24)
at render (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:93:16)
at renderPartial (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:113:12)
at Object.partial (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:270:12)
Error: Jade:24
22. 'h2 Services to monitor'
23. 'ul.services'
24. ' !=partial(\'_form_service', server.services)'
Can't set headers after they are sent.
at ServerResponse.<anonymous> (http.js:504:11)
at ServerResponse.setHeader (/usr/local/lib/node/.npm/connect/1.0.6/package/lib/patch.js:44:20)
at IncomingMessage.next (/usr/local/lib/node/.npm/connect/1.0.6/package/lib/http.js:168:13)
at error (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:277:16)
at ServerResponse.render (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:289:12)
at render (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:93:16)
at renderPartial (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:109:14)
at Object.partial (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:270:12)
at Object.anonymous (eval at <anonymous> (/usr/local/lib/node/.npm/jade/0.8.5/package/lib/jade.js:227:10))
at ServerResponse.render (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:287:24)
Error: Jade:6
4. ' input(type=\'hidden', name='_method', value='put')'
5. ' input(name=\'server[id]', value=server.id, type='hidden')'
6. ' !=partial(\'_form')'
Can't set headers after they are sent.
at ServerResponse.<anonymous> (http.js:504:11)
at ServerResponse.setHeader (/usr/local/lib/node/.npm/connect/1.0.6/package/lib/patch.js:44:20)
at IncomingMessage.next (/usr/local/lib/node/.npm/connect/1.0.6/package/lib/http.js:168:13)
at error (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:277:16)
at ServerResponse.render (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:289:12)
at render (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:93:16)
at renderPartial (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:113:12)
at Object.partial (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:270:12)
at Object.anonymous (eval at <anonymous> (/usr/local/lib/node/.npm/jade/0.8.5/package/lib/jade.js:227:10))
at ServerResponse.render (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:287:24)
http.js:504
throw new Error("Can't set headers after they are sent.");
^
Error: Can't set headers after they are sent.
at ServerResponse.<anonymous> (http.js:504:11)
at ServerResponse.setHeader (/usr/local/lib/node/.npm/connect/1.0.6/package/lib/patch.js:44:20)
at IncomingMessage.next (/usr/local/lib/node/.npm/connect/1.0.6/package/lib/http.js:168:13)
at error (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:277:16)
at ServerResponse.render (/usr/local/lib/node/.npm/express/2.0.0beta3/package/lib/view.js:289:12)
at /var/node/statusQuo/routes/server.js:47:11
at /usr/local/lib/node/.npm/mongoose/1.1.4/package/lib/mongoose/query.js:708:7
at model.<anonymous> (/usr/local/lib/node/.npm/mongoose/1.1.4/package/lib/mongoose/document.js:141:5)
at model.init (/usr/local/lib/node/.npm/mongoose/1.1.4/package/lib/mongoose/document.js:571:33)
at /usr/local/lib/node/.npm/mongoose/1.1.4/package/lib/mongoose/query.js:706:12
app.get('/server/:id/edit', function(req, res){
app.Server.findOne({_id: req.params.id}, function(err, server) {
res.render('server/edit', {server: server});
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment