/**
 * Remove a member from an association
 *
 * @param {Integer|String} parentid  - the unique id of the parent record
 * @param {Integer|String} id  - the unique id of the child record to remove
 *
 * @option {String} model  - the identity of the model
 * @option {String} alias  - the name of the association attribute (aka "alias")
 */

module.exports = function remove(req, res) {
	
	// Ensure a model can be deduced from the request options.
	var model = req.options.model || req.options.controller;
	var alias = req.options.alias;
	if (!alias || !model) return res.badRequest();

	// Get access to `sails` (globals might be disabled) and look up the model.
	var sails = req._sails;
	var Model = sails.models[model];

	// Locate and validate required parameters
	var parentid = req.param('parentid');
	if (!parentid) {
		return res.badRequest('No parentid provided.');
	}
	var id = req.param('id');
	if (!id) {
		return res.badRequest('No id provided (primary key of the record to be added.)');
	}

	Model
	.findOne(parentid).exec({
		error: res.serverError,
		success: function found(matchingRecord) {
			if (!matchingRecord) return res.notFound();
			if (!matchingRecord[alias]) return res.notFound();

			var associated = matchingRecord[alias];
			associated.remove(id);
			matchingRecord.save(function (err) {
				if (err) return res.serverError(err);

				// If we have the pubsub hook, use the model class's publish method
				// to notify all subscribers about the removed item
				if (sails.hooks.pubsub) {
					Model.publishRemove(matchingRecord.id, alias, id);

					// Get the reverse association
					var reverseModel = sails.models[_.find(Model.associations, {alias: alias}).collection];
					var reverseAssociation = _.find(reverseModel.associations, {collection: model}) || _.find(reverseModel.associations, {model: model});

					if (reverseAssociation) {
						// If this is a many-to-many association, do a publishAdd for the 
						// other side.
						if (reverseAssociation.type == 'collection') {
							reverseModel.publishRemove(id, reverseAssociation.alias, matchingRecord.id);
						}

						// Otherwise, do a publishUpdate
						else {
							var data = {};
							data[reverseAssociation.alias] = null;
							reverseModel.publishUpdate(id, data);
						}
					}

				}

				return res.json(matchingRecord);
			});
		}
	});

};
@@ -2295,24 +2295,316 @@
 %09%09%7D%0A%0A%09%09%09%09%7D%0A%0A
+%09%09%09%09Model%0A%09%09%09%09.findOne(parentid)%0A%09%09%09%09.populate(alias)%0A%09%09%09%09.exec(%7B%0A%09%09%09%09%09error: res.serverError,%0A%09%09%09%09%09success: function found(matchingRecord) %7B%0A%09%09%09%09%09%09if (!matchingRecord) return res.serverError();%0A%09%09%09%09%09%09if (!matchingRecord%5Balias%5D) return res.serverError();%0A%09%09%09%09%09%09console.log(matchingRecord);%0A%09%09
 %09%09%09%09return r
@@ -2628,16 +2628,31 @@
 ecord);%0A
+%09%09%09%09%09%7D%0A%09%09%09%09%7D);%0A
 %09%09%09%7D);%0A%09

Make add/remove response consistent.