title: Updating a model w/ Backbone.js + Rails not working (PUT route not found)
body: <p>In backbone.js I'm updating a category model:</p>
  
  <pre><code>@category.save {
    name : category_name,
  }
  </code></pre>
  
  <p>This saves fine and updates the collection properly in backbone. But on the rails serverside its not saving because of a routing error:</p>
  
  <pre><code>Started PUT "/categories" for 127.0.0.1 at 2011-05-24 11:18:16 -0400
  
  ActionController::RoutingError (No route matches "/categories"):
  </code></pre>
  
  <p>The problem is that rails expects PUT/update to have a url including the id "/categories/:id", not just "/categories"</p>
  
  <p>I tested this out by changing the model url from:</p>
  
  <pre><code>class Category extends Backbone.Model
    name: 'category'
    url: -&gt;
      host + '/categories'
  </code></pre>
  
  <p>to</p>
  
  <pre><code>class Category extends Backbone.Model
    name: 'category'
    url: -&gt;
      host + '/categories/2'
  </code></pre>
  
  <p>This works fine.</p>
  
  <pre><code>Started PUT "/categories/2" for 127.0.0.1 at 2011-05-24 11:44:08 -0400
    Processing by CategoriesController#update as JSON
    Parameters: {"category"=&gt;{"created_at"=&gt;2010-03-14 16:30:07 -0400, "id"=&gt;2, "name"=&gt;"Lunchr5", "updated_at"=&gt;2010-03-14 16:30:07 -0400, "user_id"=&gt;1}, "api_key"=&gt;"s1boakDIav30V6DzOFsY", "id"=&gt;"2"}
    User Load (0.2ms)  SELECT `users`.* FROM `users` WHERE `users`.`single_access_token` = 's1boakDIav30V6DzOFsY' LIMIT 1
    User Load (0.3ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
    SQL (0.1ms)  BEGIN
    AREL (0.3ms)  UPDATE `users` SET `visit_count` = 11, `perishable_token` = 'YG3s4yB01FxUMdMcK8m', `updated_at` = '2011-05-24 15:44:08' WHERE `users`.`id` = 1
    SQL (0.3ms)  COMMIT
    Option Load (0.3ms)  SELECT `options`.* FROM `options` WHERE (`options`.user_id = 1) LIMIT 1
    Category Load (0.2ms)  SELECT `categories`.* FROM `categories` WHERE `categories`.`id` = 2 LIMIT 1
    SQL (0.1ms)  BEGIN
    Category Load (13.1ms)  SELECT `categories`.`id` FROM `categories` WHERE `categories`.`user_id` = 1 AND (`categories`.`name` = BINARY 'Lunchr5') AND (`categories`.id &lt;&gt; 2) LIMIT 1
    AREL (0.3ms)  UPDATE `categories` SET `name` = 'Lunchr5', `updated_at` = '2011-05-24 15:44:09' WHERE `categories`.`id` = 2
    SQL (0.3ms)  COMMIT
  Redirected to http://localhost:3000/categories
  Completed 302 Found in 179ms
  </code></pre>
  
  <p>Do I have to hack backbone to add the :id to the url or am I missing something?</p>