title: "undefined method ` validates'" error - RoR Tut 5.11 Adding Some Validation
body: <p>Ruby on Rails noob here taking the Getting Started tutorial on RoR.org. I'm at section "5.11 Adding Some Validation", and am thrown an error when trying to refresh the /posts/new page:</p>
  
  <p>The error message:</p>
  
  <pre><code>NoMethodError in PostsController#new
  undefined method `  validates' for #&lt;Class:0x0000000414fab0&gt;
  
  Extracted source (around line #2):
  1 class Post &lt; ActiveRecord::Base
  2     validates :title, presence: true,
  3                       length: { minimum: 5 }
  4 end
  </code></pre>
  
  <p><strong>my post.rb:</strong></p>
  
  <pre><code>class Post &lt; ActiveRecord::Base
    validates :title, presence: true,
                      length: { minimum: 5 }
  end
  </code></pre>
  
  <p><strong>my posts_controller.rb:</strong></p>
  
  <pre><code>class PostsController &lt; ApplicationController
  
    def index
      @posts = Post.all 
    end
  
    def new
      @post = Post.new
    end
  
    def create
      @post = Post.new(params[:post].permit(:title, :text))
  
      if @post.save
        redirect_to @post
      else
        render 'new'
      end
    end
  
    def show
      @post = Post.find(params[:id])
    end
  
    private
  
    def post_params
      params.require(:post).permit(:title, :text)
    end
  end
  </code></pre>
  
  <p><strong>Sidenote -</strong> FWIW, when trying to diagnose this, I removed <code>@post = Post.new</code> from <code>posts_controller.rb</code>, and when refreshing, got this error:</p>
  
  <pre><code>undefined method `errors' for nil:NilClass
  Extracted source (around line #3):
  
      &lt;h1&gt;New Post&lt;/h1&gt;
      &lt;%= form_for :post, url: posts_path do |f| %&gt;
      &lt;% if @post.errors.any? %&gt;
        &lt;div id="error_explanation"&gt;
          &lt;h2&gt;&lt;%= pluralize(@post.errors.count, "error") %&gt; prohibited this post from being saved:&lt;/h2&gt;
        &lt;ul&gt;
  </code></pre>
  
  <p>Couldn't find anything wrong with the new.html.erb part of the equation, so I'm turning to the community for guidance. Anyone know where I am going wrong? Thanks in advance for your help.</p>