title: Rails has_one with polymorphic Association
body: <p>I'm having a problem when I try to access relationships or attributes of my models. I have the following code:</p>
  
  <pre><code>class Occupation &lt; ApplicationRecord
    belongs_to :user
    belongs_to :occupationable, polymorphic: true
  end
  </code></pre>
  
  <p>A user can have multiple occupations and these occupations have specific relationships and attributes.</p>
  
  <pre><code>class User &lt; ApplicationRecord
    has_many :occupations, dependent: :destroy
  end
  
  class Teacher &lt; ApplicationRecord
    has_one :occupation, as: :occupationable
  end
  
  class Psychologist &lt; ApplicationRecord
   has_one :occupation, as: :occupationable
  end
  
  class Parent &lt; ApplicationRecord
    has_one :occupation, as: :occupationable
    has_many :children
  end
  </code></pre>
  
  <p>The problem occurs in the Parent classes. A parent can have multiple children, but how can I access these children?</p>
  
  <p>I tried the following but unsuccessfully:</p>
  
  <pre><code>ID | OCCUPATIONABLE_ID | OCCUPATIONABLE_TYPE | USER_ID | CREATED_AT              | UPDATED_AT              
  ---|-------------------|---------------------|---------|-------------------------|-------------------------
  1  | 1                 | Parent              | 1       | 2018-07-26 13:49:06     | 2018-07-26 13:49:06           
  
  
  User.find(1).occupations.where(occupationable_type: "Parent").children
  </code></pre>
  
  <blockquote>
    <p>NoMethodError (undefined method `children' for
    Occupation::ActiveRecord_AssociationRelation:0x0000559d4c601898</p>
  </blockquote>