code: function (req) {
      var DEFAULT_POPULATE_LIMIT = req._sails.config.blueprints.defaultLimit || 30;
      var aliasFilter = req.param('populate');
      var associations = [];
      var parentModel = req.options.model;
  
      // Convert the string representation of the filter list to an Array. We
      // need this to provide flexibility in the request param. This way both
      // list string representations are supported:
      //   /model?populate=alias1,alias2,alias3
      //   /model?populate=[alias1,alias2,alias3]
      if (typeof aliasFilter === 'string') {
        aliasFilter = aliasFilter.replace(/\[|\]/g, '');
        aliasFilter = (aliasFilter) ? aliasFilter.split(',') : [];
      }
  
      _.each(aliasFilter, function(association){
        var childModel = sails.models[association.toLowerCase()];
        // iterate through parent model associations
        _.each(sails.models[parentModel].associations, function(relation){
          // check if association match childModel name
          if(relation.target.name === childModel.name) {
            var obj = { model: childModel, as: relation.options.as };
            if(relation.associationType === 'HasMany') {
              obj.limit = req._sails.config.blueprints.populateLimit || DEFAULT_POPULATE_LIMIT;
            }
            associations.push(obj);
          }
        });
      });
  
      return associations;
    }
docs: Given a request, return an object with appropriate/specified
  association attributes ( i.e. [{ model: Pet, as: 'pets' }] )
  
  @param  {Request} req
  @return {Object}