title: First argument in form cannot contain nil or be empty Hartl's Rails 4 Tutorial
body: <p>I'm working through Michael Hartl's Rails tutorial, and I'm running into an issue in section 7.3.3.  I receive this error message:</p>
  
  <pre><code>ArgumentError in Users#new
  Showing /Users/Anuraag/rails_projects/sample_app/app/views/users/new.html.erb where line #6 raised:
  First argument in form cannot contain nil or be empty
  </code></pre>
  
  <p>when I run the following rspec:</p>
  
  <pre><code>bundle exec rspec spec/requests/user_pages_spec.rb -e "signup with invalid information"
  </code></pre>
  
  <p>at the following line:</p>
  
  <pre><code>&lt;%= form_for(@user) do |f| %&gt;
  </code></pre>
  
  <p>Here is my code.  Please also let me know how I should improve this question if I'm not framing it well: I'm pretty new to StackOverflow as well</p>
  
  <p>app/views/users/new.html.erb:</p>
  
  <pre><code>&lt;% provide(:title, 'Sign up') %&gt;
  &lt;h1&gt;Sign up&lt;/h1&gt;
  
  &lt;div class="row"&gt;
    &lt;div class="span6 offset3"&gt;
      &lt;%= form_for(@user) do |f| %&gt;
        &lt;%= render 'shared/error_messages' %&gt;
  
        &lt;%= f.label :name %&gt;
        &lt;%= f.text_field :name %&gt;
  
        &lt;%= f.label :email %&gt;
        &lt;%= f.text_field :email %&gt;
  
        &lt;%= f.label :password %&gt;
        &lt;%= f.password_field :password %&gt;
  
        &lt;%= f.label :password_confirmation, "Confirmation" %&gt;
        &lt;%= f.password_field :password_confirmation %&gt;
  
        &lt;%= f.submit "Create my account", class: "btn btn-large btn-primary" %&gt;
      &lt;% end %&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>app/assets/controllers/users_controller.rb:</p>
  
  <pre><code>class UsersController &lt; ApplicationController
    def show
      @user = User.find(params[:id])
    end
  
    def create
      @user = User.new(user_params)
      if @user.save
        # Handle a successful save.
      else
        render 'new'
      end
    end
  
    private
  
      def user_params
        params.require(:user).permit(:name, :email, :password,
                                     :password_confirmation)
      end
  end
  </code></pre>
  
  <p>spec/requests/user_pages_spec.rb</p>
  
  <pre><code>require 'spec_helper'
  
  describe "User pages" do
  
    subject { page }
  
    describe "signup page" do
      before { visit signup_path }
  
      it { should have_content('Sign up') }
      it { should have_title(full_title('Sign up')) }
    end
  
    describe "profile page" do
      let(:user) { FactoryGirl.create(:user) }
      before { visit user_path(user) }
  
      it { should have_content(user.name) }
      it { should have_title(user.name) }
    end
  
    describe "signup" do
  
      before { visit signup_path }
  
      let(:submit) { "Create my account" }
  
      describe "with invalid information" do
        it "should not create a user" do
          expect { click_button submit }.not_to change(User, :count)
        end
      end
  
      describe "with valid information" do
        before do
          fill_in "Name",         with: "Example User"
          fill_in "Email",        with: "user@example.com"
          fill_in "Password",     with: "foobar"
          fill_in "Confirmation", with: "foobar"
        end
  
        it "should create a user" do
          expect { click_button submit }.to change(User, :count).by(1)
        end
      end
    end
  end
  </code></pre>