title: RESTful way to add an entity to another one (n:m relation) in Rails 3?
body: <p>this might be a very simple problem, with an easy solution, but I did not get it yet.</p>
  
  <p>Assume I have the following two models:</p>
  
  <pre><code>class Task
     has_and_belongs_to_many :users
  end
  
  class User
     has_and_belongs_to_many :tasks
  end
  </code></pre>
  
  <p>Assume further there is a user named "wayne" with id=1 and a task named "go shopping" with id=2. What would be the RESTful way to create the relationship between them through the REST interface?</p>
  
  <p>Adding a route like users/1/add_task/2 is more RPC-Style and not very RESTful. So how would you do this?</p>