title: Rails 6: Routing error while updating password from forget password link
body: <p><strong>No route matches [PATCH] "/passwords.Cl8LgygMOkPelyqCSoraMQ</strong>" is error i get try to update a password using forget password link.</p>
  
  <p>If i manually go fix routing path <strong>No route matches [PATCH] "/passwords/Cl8LgygMOkPelyqCSoraMQ</strong>" it show  a blank page.</p>
  
  <p>I don't think there should be <strong>'.'</strong> in path. I think it should be <strong>'/'</strong> in place of a route. But then i know from is this '.' coming from.</p>
  
  <p><strong>routes.rb</strong></p>
  
  <pre><code>Rails.application.routes.draw do
    root 'posts#index'
    resources :users
    resources :posts 
    resource :sessions, only: [:new, :create, :destroy]
    resources :passwords, only: [:new, :create, :edit, :update]
  
  end
  </code></pre>
  
  <p><strong>PasswordController.rb</strong></p>
  
  <pre><code>class PasswordsController &lt; ApplicationController
     def new
     end
  
     def create
        user = User.find_by_email(params[:email])
        if user 
           user.send_password_reset
           flash[:success] = "Email Sent"
           redirect_to root_url  
        else
           flash.now[:danger] = "Email address not found"
           render 'new'
        end
      end
  
  
      def edit
        @user = User.find_by_reset_password_token!(params[:id])
      end
  
  
      def update
        @user =  User.find_by_reset_password_token!(params[:id])
        if @user.reset_password_sent_at &lt; 2.hours.ago
           flash[:notice] = 'Password reset has expired'
           redirect_to new_password_path
        elsif @user.params(user_params)
           flash[:notice] = "Password has been reset"
           redirect_to new_sessions_path
        else
           render 'edit'
        end
      end
  
      private
  
      def user_params
        params.require(:user).permit(:password, :password_confirmation)
      end
  
  
  end
  </code></pre>
  
  <p><strong>Passwords - edit.html.erb</strong></p>
  
  <pre><code>&lt;div class="row"&gt;
     &lt;div class="col-md-12" style="align: center"&gt;
       &lt;h1&gt;Reset your password&lt;/h1&gt;
     &lt;/div&gt;
     &lt;div class="col-md-offset-3 col-md-9"&gt;
      &lt;% if @user.errors.any? %&gt;
          &lt;div class="error_messages"&gt;
            &lt;h2&gt;Form is invalid&lt;/h2&gt;
            &lt;ul&gt;
              &lt;% @user.errors.full_messages.each do |msg| %&gt;
                  &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;
              &lt;% end %&gt;
          &lt;/ul&gt;
          &lt;/div&gt;
      &lt;% end %&gt;
     &lt;/div&gt;
     &lt;div class="col-md-offset-3 col-md-9"&gt;
       &lt;%= form_for @user,  url: passwords_path(params[:id]) do|f| %&gt;
          &lt;div class="form-group"&gt;
              &lt;%= f.label :password, "New Password" %&gt;
              &lt;%= f.text_field :password, class: "form-control" %&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;%= f.label :confirm_password, "Confirm New Password" %&gt;
              &lt;%= f.text_field :password_confirmation, class: "form-control" %&gt;
          &lt;/div&gt;
          &lt;%= f.submit "Change Password", class: "btn btn-primary btn-block" %&gt;
       &lt;% end %&gt;
     &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/P32sI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P32sI.png" alt="enter image description here"></a></p>