title: Encountered error "NoMethodError in Posts#show"
body: <p>I am new in ruby on rails in windows.. I am following some <a href="https://www.youtube.com/watch?v=BI_VnnOLSKY" rel="nofollow noreferrer">guide through youtube</a>, but I encountered error </p>
  
  <p>Question: In part of <code>&lt;%= @post.item %&gt;</code>, what should I put in <code>@post</code>?. Is it my method or the name of the field in my another view?</p>
  
  <blockquote>
    <p>"NoMethodError in Posts#show undefined method `item' for nil:NilClass
        Extracted source (around line #2):
        1 
        2 &lt;%= @post.item %> # the error indicates here
        3 
        4 
        5 Submitted:&lt;%= time_ago_in_words(@post.created_at) %> Ago
        6 </p>
  </blockquote>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>class PostsController &lt; ApplicationController
      def index
      end
      def addItem
      end
      def create
        @post = Post.new(post_params)
        @post.save
        redirect_to @post
      end
      private
          def post_params
              params.require(:post).permit(:item, :description)
          end
      def show
          @post = Post.find(params[:id])
      end
  end
  </code></pre>
  
  <p><strong>Show.html.erb view</strong></p>
  
  <pre><code>&lt;h1 class="item"&gt;
      &lt;%= @post.item %&gt;
  &lt;/h1&gt;
  &lt;h1 class="date"&gt;
      Submitted:&lt;%= time_ago_in_words(@post.created_at) %&gt; Ago
  &lt;/h1&gt;
  &lt;h1 class="description"&gt;
      &lt;%= @post.description %&gt;
  &lt;/h1&gt;
  &lt;h1 class="date"&gt;
      Submitted:&lt;%= time_ago_in_words(@post.created_at) %&gt; Ago
  &lt;/h1&gt;
  </code></pre>
  
  <p><strong>Routes</strong></p>
  
  <pre><code>Rails.application.routes.draw do
    # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
    resources :posts
    root "posts#index"
    resources :posts
    root "posts#addItem"
  end
  </code></pre>