I am stuck in this error for quite sometime now and have hit a dead end.
I get this totally unhelpful error
can't dup NilClass
This is the situation.
I have one class which is in a relationship with another. Say
 class Parent
 end
 class Child < Parent
    unloadable
     :has_many :parents, :foreign_key => "child"
 end
The error does not occur the first time it is accessed. It occurs the second time the child is accessed.
What is exactly causing this error and is there a solution?
I referred the following link but it doesn't help
Update
I found this
But it suggests the same again. But i do have a module in my lib. It Has nothing to do with the model though.
Why are you marking the Child as unloadable? Is there a good reason for this? if not, I'd remove.
Rails API says "Unloadable constants are removed each time dependencies are cleared."
Does the error happen when you change it to:
class Child < Parent
  has_many :parents, :foreign_key => "child"
end
And, I may be overstepping, but this seems more standard:
class Child
  belongs_to :parent
end
class Parent
  has_many :children, :dependent=>:destroy
end
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With