title: NoMethodError (undefined method `user_id=' for nil:NilClass): in the article controller
body: <p>I am trying to implement the functionality of creating a new article. However when I click the Submit button it gives me the following error.</p>
  
  <pre><code>Started POST "/articles" for 127.0.0.1 at 2017-12-23 14:04:29 +0500
  Processing by ArticlesController#create as JS
    Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"lbrD/8QZAlLuxVbw3vmRuKI20zkrckYut4nebyW5hLk6EFkODh4d0IAZ6yms2oRkWGqE3eWlUQwBUrfu1SiAnw==", "article"=&gt;{"title"=&gt;"AYYE", "text"=&gt;"Ma ka "}, "commit"=&gt;"Create Article"}
    User Load (0.6ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ?  [["id", 13], ["LIMIT", 1]]
  Completed 500 Internal Server Error in 6ms (ActiveRecord: 0.6ms)
  
  
  
  NoMethodError (undefined method `user_id=' for nil:NilClass):
  
  app/controllers/articles_controller.rb:26:in `create'
  </code></pre>
  
  <p>Here's the <code>create</code> method:</p>
  
  <pre><code>def create
      @article.user_id = current_user.id
        if @article.create
           redirect_to @article
        else
          render 'new'
        end
      end
  </code></pre>
  
  <p>I am just starting out with RoR, hence unable to understand what's the problem here.</p>