My application uses a polymorhpic relationship like so:
class Child < ActiveRecord:Base
belongs_to :child_owner, polymorphic: true
end
class Parent < ActiveRecord:Base
has_many :children, as: :child_owner, dependent: :destroy
end
This setup works fine. However, when I change the attribute name of :children to a multiword variable like :kids_of_parent, I get an unintialized constant exception (for Parent::KidsOfParent). In my case, the multiword variable would be much more descriptive. What am I doing wrong? Can someone at least confirm this behaviour?
Thanks,
Chris
Using Rails 3.2.8 with ruby 1.9.3
I think you should specify a class when use the name unconventional, like this: