title: can't dup NilClass - Error
body: <p>I am stuck in this error for quite sometime now and have hit a dead end. </p>
  
  <p>I get this totally unhelpful error</p>
  
  <pre><code>can't dup NilClass
  </code></pre>
  
  <p>This is the situation.</p>
  
  <p>I have one class which is in a relationship with another. Say</p>
  
  <pre><code> class Parent
   end
  
   class Child &lt; Parent
      unloadable
       :has_many :parents, :foreign_key =&gt; "child"
   end
  </code></pre>
  
  <p>The error does not occur the first time it is accessed. It occurs the second time the child is accessed.</p>
  
  <p>What is exactly causing this error and is there a solution?</p>
  
  <p>I referred the <a href="http://strd6.com/2009/04/cant-dup-nilclass-maybe-try-unloadable/" rel="nofollow noreferrer">following link</a> but it doesn't  help</p>
  
  <p><b>Update</b></p>
  
  <p>I found <a href="https://stackoverflow.com/questions/2265145/cant-dup-nilclass-on-association-methods">this</a></p>
  
  <p>But it suggests the same again. But i do have a module in my lib. It Has nothing to do with the model though.</p>