title: Rails 4 Associations: undefined method
body: <p>I've been looking all over the web for an answer to this for the past three hours so I'm going to post a question. I'm trying to create some basic forum software but I am having trouble with my relationships. This is the error I get</p>
  
  <pre><code>undefined method `forums' for # &lt;ActiveRecord::Relation::ActiveRecord_Relation_Category:0x3706cb0&gt;
  </code></pre>
  
  <p>my categories/index file </p>
  
  <pre><code>&lt;% for category in @category %&gt;
              &lt;div class="panel panel-success"&gt;
                &lt;div class="panel-heading"&gt;
                  &lt;h3 class="panel-title"&gt;&lt;%= link_to category.name, category_path(category.id) %&gt;&lt;/h3&gt;
                  &lt;h4&gt;&lt;%= category.description %&gt; &lt;/h4&gt;
                &lt;/div&gt;
                  &lt;% for forum in @category.forums %&gt;
                    &lt;div class="panel-body"&gt;  
                      &lt;h4&gt;&lt;span class="glyphicon glyphicon-tree-conifer"&gt;&lt;/span&gt;&lt;%= link_to forum.name, forum_path(forum.id) %&gt; &lt;/h4&gt;
                    &lt;/div&gt;
                    &lt;hr /&gt;
                  &lt;% end %&gt; 
              &lt;/div&gt;
              &lt;% end %&gt;
  </code></pre>
  
  <p>Categories Controller</p>
  
  <pre><code>    class CategoriesController &lt; ApplicationController
  
        def index
          @category = Category.all
        end
  
        def show 
          @category = Category.find(params[:id])
        end
  
  end
  </code></pre>
  
  <p>forums controller </p>
  
  <pre><code>class ForumsController &lt; ApplicationController
  
    def show
      @forum = Forum.find(params[:id])
    end
   end
  </code></pre>
  
  <p>category model </p>
  
  <pre><code>class Category &lt; ActiveRecord::Base
    has_many :forums, dependent: :destroy
  end
  </code></pre>
  
  <p>forum model </p>
  
  <pre><code>class Forum &lt; ActiveRecord::Base
    belongs_to :category
    has_many :threads, dependent: :destroy
  end
  </code></pre>
  
  <p>and my routes</p>
  
  <pre><code>ForumName::Application.routes.draw do 
    root 'static_pages#home'
  
    resources :users
    resources :sessions, only: [:new, :create, :destroy]
    resources :categories, :path =&gt; "forum"
    resources :forums
    resources :topics
    resources :posts
  
    match '/signup',  to: 'users#new',          via: 'get'
    match '/signin',  to: 'sessions#new',       via: 'get'
    match '/signout', to: 'sessions#destroy',   via: 'delete'
  
  end
  </code></pre>
  
  <p>Hopefully I've provided enough info if anything else is required I'll update the post. Usually I can work these things out using google but this really has me stumped.Thanks in advance. </p>