title: trying to share a model in my app
body: <p>I am creating a website using a rails and I would like to share the model. I followed The tutorial for creating an article. In the ArticlesController is index, show, new, edit, create, update and destroy. I figured I would use this as the data entry part of my app. Then I was going to create a PageController that has home, news, videos, music and events. Here is my set up:</p>
  
  <p>here is my Article model</p>
  
  <pre><code> class Article &lt; ActiveRecord::Base
      has_attached_file :image, styles: { large:"700x700&gt;", medium:"300x300&gt;", thumb:"150x150#"}
      validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
      validates :title, presence: true,
                  length: { minimum: 5 }
      belongs_to :page
  end
  </code></pre>
  
  <p>here is my page model</p>
  
  <pre><code>class Page &lt; ActiveRecord::Base
      has_many :article
  end
  </code></pre>
  
  <p>here is my page controller</p>
  
  <pre><code> class PageController &lt; ApplicationController
    def home
   @page = Page.includes(:articles)
    end
  
    def news
    end
  
    def videos
    end
  
    def music
    end
  
    def events
    end
   end
  </code></pre>
  
  <p>here is my home view</p>
  
  <pre><code>&lt;h1&gt;Page#home&lt;/h1&gt;
  &lt;p&gt;Find me in app/views/page/home.html.erb&lt;/p&gt;
  
  
  &lt;%= @page.articles.each do |article| %&gt;
    &lt;%= article.title %&gt;
    &lt;%= article.content %&gt;
    &lt;%= article.image %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>here is the error I get</p>
  
  <pre><code> undefined method `articles' for #&lt;ActiveRecord::Relation []&gt;
  </code></pre>
  
  <p>not clear onwhats going on. Any help would be appreciated</p>