title: How can I use "Form_tag" as opposed to "Form_for" in this file
body: <p>I am new to Ruby on Rails and have been helped immensely by Michael Hartl's excellent book: Ruby on Rails Tutorial. I have gotten to Chapter 8 and am now on the exercises in that chapter. I am having ( I assume a typical "newbie") problem with exercise 1.  In this exercise it is asked "1.Refactor the signin form to use form_tag in place of form_for." I have tried to searching for assistance with this in Stackoverflow, Google, Railscast, and many other "web searches" for two days now and I do not seem to find the assistance that I need to answer this problem.  The file I am trying to modify with form_tag is below:</p>
  
  <pre><code>&lt;% provide(:title, "Sign in") %&gt;
  &lt;h1&gt;Sign in&lt;/h1&gt;
  
  &lt;div class="row"&gt;
    &lt;div class="span6 offset3"&gt;
      &lt;%= form_for(:session, url: sessions_path) do |f| %&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.submit "Sign in", class: "btn btn-large btn-primary" %&gt;
       &lt;% end %&gt;
  
      &lt;p&gt;New user? &lt;%= link_to "Sign up now!", signup_path %&gt;&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I am using Rails 3.2.3 in this application. Can anybody point me in the correct direction? Can anyone help me with this problem?  I would be most appreciative.</p>
  
  <p>This is the implementation that uses form_tag:</p>
  
  <pre><code>&lt;% provide(:title, "Sign in") %&gt;
  &lt;h1&gt;Sign in&lt;/h1&gt;
  
  &lt;div class="row"&gt;
    &lt;div class="span6 offset3"&gt;
      &lt;%= form_tag( url: sessions_path ) do  %&gt;
  
        &lt;%= label_tag :email %&gt;
        &lt;%= text_field_tag :email %&gt;
  
        &lt;%= label_tag :password %&gt;
        &lt;%= password_field_tag :password %&gt;
  
        &lt;%= submit_tag "Sign in", class: "btn btn-large btn-primary" %&gt;
      &lt;% end %&gt;
  
      &lt;p&gt;New user? &lt;%= link_to "Sign up now!", signup_path %&gt;&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I am using Rspec 2.9.0 and below are the failing tests:</p>
  
  <pre><code>describe "signin page" do
      before { visit signin_path }
  
      it { should have_selector('h1',    text: 'Sign in') }
      it { should have_selector('title', text: 'Sign in') }
    end 
  </code></pre>
  
  <p>and</p>
  
  <pre><code>describe "with invalid information" do
              before { click_button "Sign in" }
  
              it { should have_selector('title', text: 'Sign in') }
              it { should have_selector('div.alert.alert-error', text: 'Invalid') }
  
              describe "after visiting another page" do
                before { click_link "Home" }
                it { should_not have_selector('div.alert.alert-error') }
              end
        end
  </code></pre>
  
  <p>and</p>
  
  <pre><code>describe "with valid information" do
              let(:user) { FactoryGirl.create(:user) }
              before do
                fill_in "Email",    with: user.email
                fill_in "Password", with: user.password
                click_button "Sign in"
              end
  
              it { should have_selector('title', text: user.name) }
              it { should have_link('Profile', href: user_path(user)) }
              it { should have_link('Sign out', href: signout_path) }
              it { should_not have_link('Sign in', href: signin_path) }
  
              describe "followed by signout" do
                      before { click_link "Sign out" }
                      it { should have_link('Sign in') }
              end
        end
  </code></pre>
  
  <p>Here's my routes file:</p>
  
  <pre><code>SampleApp::Application.routes.draw do
    resources :users
    resources :sessions, only: [:new, :create, :destroy]
  
  
    get "users/new"
  
    root to: 'static_pages#home'
  
    match '/signup',  to: 'users#new'
    match '/signin',  to: 'sessions#new'
    match '/signout', to: 'sessions#destroy', via: :delete
  
    match '/help',    to: 'static_pages#help'
    match '/about',   to: 'static_pages#about'
    match '/contact', to: 'static_pages#contact'
  end
  </code></pre>