Skip to content

Instantly share code, notes, and snippets.

@henrypoydar
Created August 10, 2009 22:51
Show Gist options
  • Save henrypoydar/165477 to your computer and use it in GitHub Desktop.
Save henrypoydar/165477 to your computer and use it in GitHub Desktop.
// PROBLEM:
// A Sammy app
// Current code with nested view queries:
get('#/renderings', function() {
var ctx = this;
couchapp.design.view("renderings", {
include_docs: true,
success: function(jsona) {
//console.log(jsona);
couchapp.design.view("sketches", {
include_docs: true,
success: function(jsonb) {
//console.log(jsonb);
ctx.partial('views/renderings/index.html', {sketches: jsonb.rows.reverse(), renderings: jsona.rows.reverse()});
}
});
}
});
});
// Psuedo code I'd like to find syntax for:
get('#/renderings', function() {
var ctx = this;
var renderings = couchapp.design.view("renderings", {...});
var sketches = couchapp.design.view("sketches", {...});
ctx.partial('views/renderings/index.html', {sketches: sketches, renderings: renderings});
});
// SOLUTION
// Patched jquery.couchapp.js and jquery.couch.js to accept ajaxOptions that are passed to the db.view function, which are then merged into the $.ajax call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment