Last active
December 21, 2015 03:19
-
-
Save julianlconnor/6241532 to your computer and use it in GitHub Desktop.
Passing multiple models and collections to a view via Rendr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// controller | |
module.exports = { | |
index: function(params, callback) { | |
var spec = { | |
posts: { collection: 'Posts', params: params }, | |
feed: { collection: 'Feed', params: params }, | |
user: { model: 'User', params: params, ensureKeys: ['name'] }, | |
session: { model: 'Session', params: params } | |
}; | |
this.app.fetch(spec, function(err, result) { | |
callback(err, result); | |
}); | |
} | |
}; | |
// view | |
var BaseView = require('../base'); | |
module.exports = BaseView.extend({ | |
className: 'home_index_view', | |
postInitialize: function() { | |
console.log(this.options.posts); | |
console.log(this.options.feed); | |
console.log(this.options.user); | |
console.log(this.options.session); | |
} | |
}); | |
module.exports.id = 'home/index'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment