title: How to delete an object of a has_many where the parent object is not yet saved
body: <p>I have an @activity that has_many :clientships</p>
  
  <p>When creating a new object I assign several Clientship objects but before saving, the user wants to pick out a few to delete.</p>
  
  <p>How would I delete one of the following Clientship objects based on a user-defined client_id?</p>
  
  <p>The collection looks like this:</p>
  
  <pre><code>@activity.clientships [
    #&lt;Clientship id: nil, client_id: 1770&gt;,
    #&lt;Clientship id: nil, client_id: 24&gt;,
    #&lt;Clientship id: nil, client_id: 25&gt;,
    #&lt;Clientship id: nil, client_id: 2181,&gt;
  ]
  </code></pre>
  
  <p>The example code I tried which didn't work (not to mention inefficient):</p>
  
  <pre><code>@activity.clientships.map {|o| o.delete if o.client_id==24 }
  </code></pre>