title: undefined method 'each' Ruby on Rails
body: <p>Apologies in advance, I am a newbie trying to get my head around rails.</p>
  
  <p>My View at the bottom works when I use:</p>
  
  <pre><code>def show
  @posts = Post.all
  end
  </code></pre>
  
  <p>However in my controller I now have:</p>
  
  <pre><code>def show
  @posts = Post.find_by_category_id params[:id];
  end
  </code></pre>
  
  <p>In my view I have</p>
  
  <pre><code>&lt;%= @posts.each do |post| %&gt;
  &lt;%= post.title %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Some please explain why I get this error. What should I use. category_id is a foreign key on the Post table.</p>