Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8777097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:12:43+00:00 2026-06-13T19:12:43+00:00

My application uses a polymorhpic relationship like so: class Child < ActiveRecord:Base belongs_to :child_owner,

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:12:44+00:00Added an answer on June 13, 2026 at 7:12 pm

    I think you should specify a class when use the name unconventional, like this:

    has_many :kids_of_parent, as: :child_owner, class_name: "Child", dependent: :destroy
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have content management system application that uses a polymorphic tree table as the
My application uses an MDI form, and there are instances where the end user
I've a tree-like polymorphic data-structure, where the nodes are instances of class Node (implemented
My application uses the 'twisted.web.client.Agent' to get web content. But the Agent class requires
My Application uses camera, I would like to add overlay over the camera preview.
Our application uses several back-end services and we maintain wrappers which contain the methods
My application uses a MapView which will display multiple places. I have the latitude
My application uses a 3rd party dll. If I remove myapp.exe.local file from my
My application uses asp.net 4, C# and Entity Framework. My database contains a table
My application uses MySQL, on my server, as its database. My server is highly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.