title: Backbone.js with a custom fetch URL
body: <p>I am trying to set up a variant fetch method on my backbone model that will fetch the current model for a given user. This is available from the API on <code>/api/mealplans/owner/{username}/current</code>.</p>
  
  <p>I have written the following model. I commented out the URL Root, as the prototype fetch call was simply using the <code>urlRoot</code> and I wanted to see if that was overriding the url parameter I passed in portions somehow.</p>
  
  <pre><code>var mealPlan = Backbone.Model.extend({
    name: 'Meal Plan',
    //urlRoot: '/api/mealplans',
    defaults: {},
    fetchCurrent: function (username, attributes, options) {
      attributes = attributes || {};
      options = options || {};
      if (options.url === undefined) {
        options.url = "/api/mealplans/owner/" + username + "/current";
      }
      return Backbone.Model.prototype.fetch.call(this, attributes, options);
    },
    validate: function (attributes) {
      // To be done
      return null;
    }
  });
  </code></pre>
  
  <p>I've seen this done, in some variations in other places, such as at <a href="https://stackoverflow.com/questions/7644767/backbone-js-use-different-urls-for-model-save-and-fetch">backbone.js use different urls for model save and fetch</a> - In that case the code is slightly different (I started with that and broke it down to make it easier for me to read.)</p>
  
  <p>The options object has the url parameter in it fine when I pass it to fetch, but then it seems to ignore it!</p>