Rails render named route with correct URL
===

I have the following route in my rails application

    match '/settings', to: 'Users#edit', as: 'settings'

And corresponding controller code

    def edit
      @user = current_user
    end

    def update
      correct_user
      @user = User.find(params[:id])
      if !@user.authenticate(params[:old_password])
        flash[:error] = 'Old password did not match'
        redirect_to settings_path
      elsif @user.update_attributes(params[:user])
        flash[:success] = "Settings updated"
        redirect_to settings_path
      else
        render 'edit'
      end
    end

My edit page is as of now just a password change page, and when I visit `/settings` I see the page I'd except. When I `redirect_to settings_path`, the url remains `/settings`, which is the behavior I want.

In my `edit` template, I have code to handle object errors and render them on the page. When `render 'edit`, this code is triggered if there was an object error. If I redirect to the page, however, the code is not there. So I need to call `render 'edit'` to see the errors.

However, calling `render 'edit'` causes the URL to change to `/users/:id/edit`, which is exactly what I **don't** want. I'd like the URL to remain `/settings` after calling `render 'edit'`. How can I achieve this?

**NOTE:** I've already searched SO and other parts of the internet but have found nothing that suits my needs. There are one or two SO topics with similar issues but they all use flashing and hacky redirect-based workarounds, which is not what I want.