title: Getting "Couldn't find Item without an ID" when trying to render to a view.
body: <p>I am new to programming, 12 weeks in to  learning Ruby on Rails, and this SHOULD be an easy problem, but  its not. I have a feature spec (I'm using Capybara and RSpec) I'm running on a simple "To do" list application. I want to render @item to items#show and the test keeps failing:</p>
  
  <pre><code>Failures:
  
    1) User creates ITEM Successfully
       Failure/Error: expect( page ).to have_content('washcar')
         expected to find text "washcar" in "Your new ITEM was saved. Your new ITEM was saved."
       # ./spec/features/user_creates_item.rb:10:in `block (2 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>Here is the show view: </p>
  
  <pre><code>&lt;p&gt;&lt;b&gt;&lt;%= @item.body %&gt;&lt;/b&gt;&lt;/p&gt;
  </code></pre>
  
  <p>Okay, simple so far. Here is the item controller:</p>
  
  <pre><code>class ItemsController &lt; ApplicationController
  
    def new
    end
  
  
  
    def create
      @item = Item.new(item_params)
      @item.save
      redirect_to @item, notice: 'Your new ITEM was saved.'
    end
  
    def show
      @item = Item.find(params[:id])
    end
  
  
    def index
    end  
  
  private
  
     def item_params
       params.require(:item).permit(:body)
     end
   end
  </code></pre>
  
  <p>Here is the spec:</p>
  
  <pre><code>require 'rails_helper' 
  
  feature 'User creates ITEM' do
    scenario 'Successfully' do
      visit new_item_path
      fill_in 'Body', with:'washcar'
      click_button 'Save' 
  
      expect( page ).to have_content('Your new ITEM was saved')    
      expect( page ).to have_content('washcar')
    end  
  end
  </code></pre>
  
  <p>Here is items#new</p>
  
  <pre><code>&lt;h1&gt;Items#new&lt;/h1&gt;
  
  &lt;%= form_for Item.new do |form| %&gt;
    &lt;%= form.text_field :body, placeholder: 'Body' %&gt; 
     &lt;%= form.submit 'Save' %&gt;
  &lt;% end %&gt; 
  </code></pre>
  
  <p>and here is the item model: </p>
  
  <pre><code>class Item &lt; ActiveRecord::Base
    belongs_to :list
  
    scope :unfinished, -&gt; { where('done' =&gt; false) }
    scope :unfinished_and_recent, -&gt; { unfinished.where("created_at &gt; ?", Time.now-7.days) }
    scope :finished, -&gt; { where('done' =&gt; true) }
  
    validates :body, length: { minimum: 5 }, presence: true
    validates :list, presence: true
   end
  </code></pre>
  
  <p>My understanding is: on item#new, the test provides the body for the item "washcar' and form.submit 'Save' sends a request to the router, which matches the request to the ItemsController create method. There, the private method item_params passes body and item info to Item.new, which is then assigned to @item. @item.save saves the item to the db, and redirect_to @item redirects to the show method. params passes the item saved in the database to Item.find, which is then assigned to @item. items#show is then supposed to render @item.body to the view, but it looks like it doesn't. Where am I going wrong?  </p>