title: Ruby has_many without destroy
body: <p>I'm facing a model problem. I've 3 models : User, Address and Residence</p>
  
  <p>User:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    acts_as_paranoid
  
    has_one :address, dependent: :destroy #should be has_many but not current problem
    has_many :objects, dependent: :destroy
    has_many :residences, dependent: :destroy
  end
  </code></pre>
  
  <p>Address</p>
  
  <pre><code>class Address &lt; ActiveRecord::Base
    acts_as_paranoid
  
    belongs_to :user, inverse_of: :address
    belongs_to :residence, inverse_of: :address
  
    validates :user, presence: true
  </code></pre>
  
  <p>end</p>
  
  <p>Residence:</p>
  
  <pre><code>class Residence &lt; ActiveRecord::Base
    belongs_to :user
  
    has_one :address, through: :user, dependent: :nullify
    has_many :objects, through: :user
  end
  </code></pre>
  
  <p>The problem is when I want to delete a User or a Residence The system failed to delete residence due to a foreign key and the system said to me that cannot be done because still reference to residence in adresses table.</p>
  
  <p>I don't want to delete address linked to Residence when I delete residence, address should only be delete bu user deletion (that's why i try to use <code>nullify</code> without luck.</p>
  
  <p>Need I to use a join table instead of references between residences and addresses?</p>
  
  <p>Thanks</p>