title: Rails Has Many relation
body: <p>I have two models that two relationships between them </p>
  
  <pre><code>class Tracking
    include Mongoid::Document
  
    belongs_to :origin_courier, :class_name =&gt; "Courier", foreign_key: "origin_courier_id"
    belongs_to :destination_courier, :class_name =&gt; "Courier", foreign_key: "destination_courier_id"
  
  end
  
  class Courier
    include Mongoid::Document
  
    has_many :origins, class_name: 'Tracking', foreign_key: "origin_courier_id"
    has_many :destinations, class_name: 'Tracking', foreign_key: "destination_courier_id"
  end
  </code></pre>
  
  <p>When I assign a courier to the origin_courier of a newly created tracking, it run fine. </p>
  
  <pre><code>1.9.3p194 :015 &gt; t = Tracking.new
   =&gt; #&lt;Tracking _id: 4fbcc2772cfb397930000003, _type: nil, created_at: nil, updated_at: nil, origin_courier_id: nil, destination_courier_id: nil&gt; 
  1.9.3p194 :016 &gt; t.origin_courier = Courier.last
   =&gt; #&lt;Courier _id: 4fbcbb072cfb397657000004, _type: nil, created_at: 2012-05-23 10:25:11 UTC, updated_at: 2012-05-23 10:25:11 UTC&gt; 
  1.9.3p194 :017 &gt; t
   =&gt; #&lt;Tracking _id: 4fbcc2772cfb397930000003, _type: nil, created_at: nil, updated_at: nil, origin_courier_id: BSON::ObjectId('4fbcbb072cfb397657000004'), destination_courier_id: nil&gt; 
  1.9.3p194 :018 &gt; t.save
   =&gt; true 
  1.9.3p194 :019 &gt; t
   =&gt; #&lt;Tracking _id: 4fbcc2772cfb397930000003, _type: nil, created_at: 2012-05-23 10:57:14 UTC, updated_at: 2012-05-23 10:57:14 UTC, origin_courier_id: BSON::ObjectId('4fbcbb072cfb397657000004'), destination_courier_id: nil&gt;
  </code></pre>
  
  <p>But when I assign a courier to the destination_courier of a newly created tracking, it duplicates the value to origin_courier</p>
  
  <pre><code>1.9.3p194 :020 &gt; t2 = Tracking.new
   =&gt; #&lt;Tracking _id: 4fbcc3002cfb397930000004, _type: nil, created_at: nil, updated_at: nil, origin_courier_id: nil, destination_courier_id: nil&gt; 
  1.9.3p194 :021 &gt; t2.destination_courier = Courier.last
   =&gt; #&lt;Courier _id: 4fbcbb072cfb397657000004, _type: nil, created_at: 2012-05-23 10:25:11 UTC, updated_at: 2012-05-23 10:25:11 UTC&gt; 
  1.9.3p194 :022 &gt; t2.save
   =&gt; true 
  1.9.3p194 :023 &gt; t2
   =&gt; #&lt;Tracking _id: 4fbcc3002cfb397930000004, _type: nil, created_at: 2012-05-23 11:00:39 UTC, updated_at: 2012-05-23 11:00:39 UTC, origin_courier_id: BSON::ObjectId('4fbcbb072cfb397657000004'), destination_courier_id: BSON::ObjectId('4fbcbb072cfb397657000004')&gt;
  </code></pre>
  
  <p>How can I resolve this?</p>
  
  <p>Thanks.</p>