assets/js/vendor/backbone-relational.js
function( key, options, refresh ) {
			// Set default `options` for fetch
			options = _.extend( { update: true, remove: false }, options );

			var setUrl,
				requests = [],
				rel = this.getRelation( key ),
				idsToFetch = rel && ( ( rel.keyIds && rel.keyIds.slice( 0 ) ) || ( ( rel.keyId || rel.keyId === 0 ) ? [ rel.keyId ] : [] ) );

			// On `refresh`, add the ids for current models in the relation to `idsToFetch`
			if ( refresh ) {
				var models = rel.related instanceof Backbone.Collection ? rel.related.models : [ rel.related ];
				_.each( models, function( model ) {
					if ( model.id || model.id === 0 ) {
						idsToFetch.push( model.id );
					}
				});
			}

			if ( idsToFetch && idsToFetch.length ) {
				// Find (or create) a model for each one that is to be fetched
				var created = [],
					models = _.map( idsToFetch, function( id ) {
						var model = Backbone.Relational.store.find( rel.relatedModel, id );

						if ( !model ) {
							var attrs = {};
							attrs[ rel.relatedModel.prototype.idAttribute ] = id;
							model = rel.relatedModel.findOrCreate( attrs, options );
							created.push( model );
						}

						return model;
					}, this );

				// Try if the 'collection' can provide a url to fetch a set of models in one request.
				if ( rel.related instanceof Backbone.Collection && _.isFunction( rel.related.url ) ) {
					setUrl = rel.related.url( models );
				}

				// An assumption is that when 'Backbone.Collection.url' is a function, it can handle building of set urls.
				// To make sure it can, test if the url we got by supplying a list of models to fetch is different from
				// the one supplied for the default fetch action (without args to 'url').
				if ( setUrl && setUrl !== rel.related.url() ) {
					var opts = _.defaults(
						{
							error: function() {
								var args = arguments;
								_.each( created, function( model ) {
									model.trigger( 'destroy', model, model.collection, options );
									options.error && options.error.apply( model, args );
								});
							},
							url: setUrl
						},
						options
					);

					requests = [ rel.related.fetch( opts ) ];
				}
				else {
					requests = _.map( models, function( model ) {
						var opts = _.defaults(
							{
								error: function() {
									if ( _.contains( created, model ) ) {
										model.trigger( 'destroy', model, model.collection, options );
										options.error && options.error.apply( model, arguments );
									}
								}
							},
							options
						);
						return model.fetch( opts );
					}, this );
				}
			}

			return requests;
		}
function( key, options, refresh ) {
			// Set default `options` for fetch
			options = _.extend( { update: true, remove: false }, options );

			var setUrl,
				requests = [],
				rel = this.getRelation( key ),
				idsToFetch = rel && ( ( rel.keyIds && rel.keyIds.slice( 0 ) ) || ( ( rel.keyId || rel.keyId === 0 ) ? [ rel.keyId ] : [] ) );

			// On `refresh`, add the ids for current models in the relation to `idsToFetch`
			if ( refresh ) {
				var models = rel.related instanceof Backbone.Collection ? rel.related.models : [ rel.related ];
				_.each( models, function( model ) {
					if ( model.id || model.id === 0 ) {
						idsToFetch.push( model.id );
					}
				});
			}

			if ( idsToFetch && idsToFetch.length ) {
				// Find (or create) a model for each one that is to be fetched
				var created = [],
					models = _.map( idsToFetch, function( id ) {
						var model = Backbone.Relational.store.find( rel.relatedModel, id );

						if ( !model ) {
							var attrs = {};
							attrs[ rel.relatedModel.prototype.idAttribute ] = id;
							model = rel.relatedModel.findOrCreate( attrs, options );
							created.push( model );
						}

						return model;
					}, this );

				// Try if the 'collection' can provide a url to fetch a set of models in one request.
				if ( rel.related instanceof Backbone.Collection && _.isFunction( rel.related.url ) ) {
					setUrl = rel.related.url( models );
				}

				// An assumption is that when 'Backbone.Collection.url' is a function, it can handle building of set urls.
				// To make sure it can, test if the url we got by supplying a list of models to fetch is different from
				// the one supplied for the default fetch action (without args to 'url').
				if ( setUrl && setUrl !== rel.related.url() ) {
					var opts = _.defaults(
						{
							error: function() {
								var args = arguments;
								_.each( created, function( model ) {
									model.trigger( 'destroy', model, model.collection, options );
									options.error && options.error.apply( model, args );
								});
							},
							url: setUrl
						},
						options
					);

					requests = [ rel.related.fetch( opts ) ];
				}
				else {
					requests = _.map( models, function( model ) {
						var opts = _.defaults(
							{
								error: function() {
									if ( _.contains( created, model ) ) {
										model.trigger( 'destroy', model, model.collection, options );
										options.error && options.error.apply( model, arguments );
									}
								}
							},
							options
						);
						return model.fetch( opts );
					}, this );
				}
			}

			return requests;
		}
Retrieve related objects.
@param key {string} The relation key to fetch models for.
@param [options] {Object} Options for 'Backbone.Model.fetch' and 'Backbone.sync'.
@param [refresh=false] {boolean} Fetch existing models from the server as well (in order to update them).
@return {jQuery.when[]} An array of request objects