Skip to content

Commit

Permalink
addressing the review notes from @drew, moving models out of the spec…
Browse files Browse the repository at this point in the history
…->config. TODO: RS will have to change to not use instance->models
  • Loading branch information
caridy committed Sep 5, 2012
1 parent 8944ca8 commit b6c3992
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/app/autoload/controller-context.common.js
Expand Up @@ -57,11 +57,15 @@ YUI.add('mojito-controller-context', function(Y, NAME) {
// initialization process.
models = this._expandModels(configCombo);

// using configCombo->models as a mapping to pass some models
// instances as attributes through the configuration into the
// controller. This will facilitate the access to global models.
Y.Object.each((configCombo.models || {}), function(modelName, attrName) {
configCombo[attrName] = models[modelName];
// using instance->models as a mapping to pass some models
// instances as part of the configuration into the
// controller. This will facilitate the access to global models in
// a form of config.modelName or this.get('modelName') if using
// attributes in the controller.
Y.Object.each((instance.models || {}), function(modelName, attrName) {
if (models[modelName]) {
configCombo[attrName] = models[modelName];
}
});

if (Y.Lang.isFunction(originalController)) {
Expand Down

0 comments on commit b6c3992

Please sign in to comment.