title: rails - displaying nested find hash
body: <p>I am trying to display the output of this find -</p>
  
  <pre><code>@test = User.joins(:plans =&gt; [:categories =&gt; [:project =&gt; :presentations]]).where(current_user.id)
  </code></pre>
  
  <p>Here is my output loop</p>
  
  <pre><code>&lt;% @test.each do |p| %&gt;
    &lt;%= p.plans %&gt;
    &lt;% p.plans.each do |d| %&gt;
      &lt;%= debug(d) %&gt;
      &lt;% d.categories.each do |e| %&gt;
        &lt;% e.project.each do |r| %&gt;
         &lt;%= debug(r) %&gt;
        &lt;% end %&gt;
  &lt;% end %&gt;
    &lt;% end %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>The loop works until it gets to project when it throws this error</p>
  
  <pre><code>undefined method `each' for "#&lt;Project:0x000001033d91c8&gt;":Project
  </code></pre>
  
  <p>If I change it to projects in the loop it gives this error</p>
  
  <pre><code>undefined method `projects' for #&lt;Plan:0x000001033da320&gt;
  </code></pre>
  
  <p>The debug at categories level shows this </p>
  
  <pre><code>--- !ruby/object:Category 
  attributes: 
   id: 2
   name: test
   short_name: tst
   created_at: 
   updated_at: 
   category_id: 2
   plan_id: 5
  </code></pre>
  
  <p>My relationships look like this </p>
  
  <p>User
   has_many :user_plans
  Plan
   has_many :user_plans
   has_and_belongs_to_many :categories
  Category
   has_one :project
   has_and_belongs_to_many :plans
  Project
   has_many :presentations, :dependent => :delete_all
  Presentation
   belongs_to :project</p>
  
  <p>Do I need to changed my find ?</p>
  
  <p>Thanks, Alex</p>