title: Rails Routing Error? 'No route matches'
body: <p>So I keep running into the following error:</p>
  
  <blockquote>
    <p><code>No route matches {:action=&gt;"show", :controller=&gt;"users"}</code></p>
  </blockquote>
  
  <p>I tried running rake routes and I can see that the route exists:</p>
  
  <pre><code> user         GET          /users/:id(.:format)       users#show
                PUT          /users/:id(.:format)       users#update
                DELETE       /users/:id(.:format)       users#destroy
  </code></pre>
  
  <p>But every time I try visiting the page <code>"/users/1"</code> (1 being the user id), I get the above error. Any ideas? Thanks! </p>
  
  <p>Here's my <code>routes.rb</code>:</p>
  
  <pre><code>SampleApp::Application.routes.draw do
    root to: 'static_pages#home'
  
    resources :users
    resource :sessions, only: [:new, :create, :destroy]
  
  
    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'
  </code></pre>
  
  <p>Here's my <code>users_controller.rb</code>:</p>
  
  <pre><code>class UsersController &lt; ApplicationController
  
    before_filter :signed_in_user, only: [:index, :edit, :update]
    before_filter :correct_user,   only: [:edit, :update]
  
    def show
      @user = User.find(params[:id])
    end
  
    def new
      @user = User.new
    end
  
    def create
      @user = User.new(params[:user])
      if @user.save
        sign_in @user
        flash[:success] = "Welcome to the Paper Piazza!"
        redirect_to @user
      else
        render 'new'
      end
    end
  
    def edit
      @user = User.find(params[:id])
    end
  
    def update
      if @user.update_attributes(params[:user])
        flash[:success] = "Profile updated"
        sign_in @user
        redirect_to @user
      else
        render 'edit'
      end
    end
  
    def index
      @users = User.paginate(page: params[:page])
    end
  
    private
  
      def signed_in_user
        unless signed_in?
          store_location
          redirect_to signin_path, notice: "Please sign in."
        end
      end
  
      def correct_user
        @user = User.find(params[:id])
        redirect_to(root_path) unless current_user?(@user)
      end
  end
  </code></pre>