Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7056555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:52:51+00:00 2026-05-28T03:52:51+00:00

Ruby on rails 3.1.3 I’m trying to figure out the correct route to my

  • 0

Ruby on rails 3.1.3

I’m trying to figure out the correct route to my change_password method of my users_controller.

I’m currently getting this error:

Routing Error

No route matches {:action=>"change_password", :controller=>"users", :format=>#<User id: 1, email: "foo@bar.baz", encrypted_password: "$2a$10$lgmrRTYFUUrWStLl1Y.Oo.LqQ2Ybxa29YkDFw61/KG9O...", password_salt: "$2a$10$lgmrRTYFUUrWStLl1Y.Oo.", username: "foobar", created_at: "2012-01-07 23:02:29", updated_at: "2012-01-13 11:16:45", password_reset_token: nil, password_reset_sent_at: "2012-01-08 12:23:30">}

In users_controller:

def change_password
      @user = current_user
      @user_password_matches = User.authenticate(@user.email, params[:current_password])
      if @user_password_matches.update_attributes(params[:user])
        login @user
        format.js   { render :js => "window.location = '#{settings_account_path}'" } 
        flash[:success] = "Password updated" 
      else
        format.js   { render :form_errors }

      end
    end

Inside view:

<%= form_for @user, :remote => true, :url => change_password_path(@user) do |f| %>
Current password: <%= password_field_tag :current_password, :placeholder => "Password"  %><br />
New password: <%= f.password_field :password, :placeholder => "Password"  %><br />
Confirm password: <%= f.password_field :password_confirmation, :placeholder => "Confirm Password"  %><br />
<%= f.submit 'update' %>

routes:

resources :users do
  member do
    put :change_password
  end
end
  resources :users
  resources :sessions
  resources :passwords
  resources :profiles


  root :to                   => "users#new"
  match 'success'            => "users#success"
  match 'login'              => "sessions#new"
  match 'logout'             => "sessions#destroy"
  match 'reset_password'     => "passwords#new"
  match 'setup_new_password' => "passwords#edit"
  match 'settings', :to      => "users#settings"


  match "/settings/account", :to => "users#account"
  match "/settings/edit_profile", :to => "profiles#edit_profile"


  match '/:username', :controller => 'users', :action => 'show'

All I’m intending to do is only update the attributes in db if users entered password (:current_password) successfully passes authentication (the same method I use to log in users which would confirm password matches the one stored in the db) and if it does take the params of users form , in this case the newly hashed password and store it in the db..

Kind regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:52:52+00:00Added an answer on May 28, 2026 at 3:52 am

    You’ve got the wrong path name in your form, it’s change_password_user_path, not change_password_path.

    Use rake routes to see the names of your routes. Also, you don’t need a custom route for this, check my answer to your previous question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm brand new to Ruby/Rails/RSpec, and hopefully this is a dumb/simple question. I'm currently
I'm trying to follow the guide here: http://docs.cloudfoundry.com/frameworks/ruby/rails-3-1.html And I have worked out many
This is a little out of the ordinary for a normal Ruby/Rails application. I
Hello Ruby/Rails/Merb developers! Im currently working on a web project that will have a
This is not a ruby/rails project deploy. I have the following situation and I
I'm new to ruby/rails and trying to build a simple Projects / Tags app
I'm just starting out with Ruby/Rails and am wondering what Rails developers use to
What is the best way to generate a random DateTime in Ruby/Rails? Trying to
I currently have a Ruby (Rails) application that needs to make a lot of
I'm a new ruby/rails user trying to get my mac set up for the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.