title: Rails -Couldn't find User with 'id'=
body: <p>I've been developing a site based on the Hartl's guide. I want to move the password reset functionality to it own partial. </p>
  
  <p>I created a partial, _passreset.html.erb. Essentially a copy of the _form that only shows your username and displays the password/password_confirm fields. </p>
  
  <p>But I'm not even getting there. On the show.html.erb page (the profile page), I have links to Edit and Password Reset. Here is the code:</p>
  
  <pre><code>   &lt;% if current_user.admin? || current_user == @user %&gt;
     &lt;%= link_to "Edit", edit_user_path(@user) %&gt; | 
     &lt;%= link_to "Password Reset", user_passreset_path(@user)%&gt;
     &lt;% end %&gt;
  </code></pre>
  
  <p>When I click on the "Password Reset" link, I get the follow error: <br>
  ActiveRecord::RecordNotFound in UsersController#show<br>
  Couldn't find User with 'id'=passreset</p>
  
  <p>The source is my users controller set_user function:</p>
  
  <pre><code>def set_user
    @user = User.find(params[:id])
  end
  </code></pre>
  
  <p>The route for the new function looks like this:</p>
  
  <pre><code>resources :users do
  resources :articles
  get 'passreset'
  end
  </code></pre>
  
  <p>rake routes shows this line:</p>
  
  <pre><code> user_passreset GET    /users/:user_id/passreset(.:format)                 users#passreset
  </code></pre>
  
  <p>I've also explicitly declared the route (get 'users/passreset'), it doesn't make a difference. </p>
  
  <p>Why is it looking for an id of 'passreset'? I don't get it. </p>
  
  <p>I don't think it matters, but this is the passrest function from my users controller:</p>
  
  <pre><code> def passreset
   respond_to do |format|
    if @user.update(user_params)
      format.html { redirect_to @user, notice: 'Password was      successfully updated.' }
      format.json { render :show, status: :ok, location: @user }
    else
      format.html { render :edit }
      format.json { render json: @user.errors, status:  :unprocessable_entity }
    end
  end
  end
  </code></pre>