title: Rails 4 error - rails Couldn't find User with 'id'=index
body: <p>I am trying to make an app in Rails 4.</p>
  
  <p>I'm trying to follow CyberDude's advice in this post:</p>
  
  <p><a href="https://stackoverflow.com/questions/33950172/defining-roles-with-rolify">Defining Roles with Rolify</a></p>
  
  <p>I'm getting stuck at the part where I make an index for users in the user/views file.</p>
  
  <p>I am getting an error that says: </p>
  
  <pre><code>ActiveRecord::RecordNotFound in UsersController#show
  Couldn't find User with 'id'=index
  
  Extracted source (around line #69):
  67
  68
  69
  70
  71
  72
  
    private
      def set_user
        @user = User.find(params[:id])
      end
  
      def user_params
  </code></pre>
  
  <p>I can't understand this error message. Others with similar messages seem to have problems arising in other actions (like #show) where an :id is required. I think index doesn't need and id (but I'm not sure about that).</p>
  
  <p>I have:</p>
  
  <p>User's controller (I also have a folder in my controllers called "user" and it has controllers for regirations and omniauth callbacks):</p>
  
  <pre><code>class UsersController &lt; ApplicationController
  
  before_action :set_user, only: [:index, :show, :edit, :update, :finish_signup, :destroy]
  
    def index
      # if params[:approved] == "false"
      #   @users = User.find_all_by_approved(false)
      # else
        @users = User.all
      # end
  
    end
  
    # GET /users/:id.:format
    def show
      # authorize! :read, @user
    end
  
    # GET /users/:id/edit
    def edit
      # authorize! :update, @user
    end
  
    # PATCH/PUT /users/:id.:format
    def update
      # authorize! :update, @user
      respond_to do |format|
        if @user.update(user_params)
          sign_in(@user == current_user ? @user : current_user, :bypass =&gt; true)
          format.html { redirect_to @user, notice: 'Your profile was successfully updated.' }
          format.json { head :no_content }
        else
          format.html { render action: 'edit' }
          format.json { render json: @user.errors, status: :unprocessable_entity }
        end
      end
    end
  
    # GET/PATCH /users/:id/finish_signup
    def finish_signup
      # authorize! :update, @user
  
  
      if request.patch? &amp;&amp; params[:user] #&amp;&amp; params[:user][:email]
        if @user.update(user_params)
          @user.skip_reconfirmation!
          sign_in(@user, :bypass =&gt; true)
          redirect_to root_path, notice: 'Your profile was successfully updated.'
          # redirect_to [@user, @user.profile || @user.build_profile]
          # sign_in_and_redirect(@user, :bypass =&gt; true)
        else
          @show_errors = true
        end
      end
    end
  
    # DELETE /users/:id.:format
    def destroy
      # authorize! :delete, @user
      @user.destroy
      respond_to do |format|
        format.html { redirect_to root_url }
        format.json { head :no_content }
      end
    end
  
    private
      def set_user
        @user = User.find(params[:id])
      end
  
      def user_params
        # params.require(:user).permit(policy(@user).permitted_attributes)
        accessible = [ :first_name, :last_name, :email, :avatar, {role_ids: []} ] # extend with your own params
        accessible &lt;&lt; [ :password, :password_confirmation ] unless params[:user][:password].blank?
        # accessible &lt;&lt; [:approved] if user.admin
        params.require(:user).permit(accessible)
      end
  
  end
  </code></pre>
  
  <p>I have a users index view:</p>
  
  <pre><code>&lt;div class="col-xs-10 col-xs-offset-1" style="margin-left:10%; margin-right:10%"&gt;
      &lt;% Users.each do |user| %&gt;
        &lt;div class="row"&gt;
              &lt;div class="col-xs-5"&gt;
                  &lt;%= link_to "#{user.full_name}", user %&gt;
              &lt;/div&gt;
              &lt;div class="col-xs-5"&gt;
                  &lt;%= link_to "#{user.email}", user %&gt;
              &lt;/div&gt;
              &lt;div class="col-xs-2"&gt;
                   &lt;%= link_to "edit", edit_user_path(user) %&gt;
              &lt;/div&gt;
      &lt;/div&gt; 
      &lt;% end %&gt;   
  </code></pre>
  
  <p>When I try this, I get the error I posted above.</p>
  
  <p>Can anyone see what I've done wrong, or decipher the error message?</p>