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

  • Home
  • SEARCH
  • 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 8060671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:04:21+00:00 2026-06-05T10:04:21+00:00

New issue I’m dealing with as I develop my first Rails (Ruby as well

  • 0

New issue I’m dealing with as I develop my first Rails (Ruby as well for that matter) application.

I am using (in that specific order): Devise, Registration, User

After I generated the Registration scaffolding/model, I moved the files from devise/views/registrations to /views/registrations.

After I generated the User scaffolding, I moved edit.html.erb and show.html.erb to /views/users

I am not using a specific admin controller, but I have some code in there that checks the current_user for admin privileges, and if so, I want to give the admin the ability to edit any user’s information, without having to enter a password. So, the form I’m displaying for edit skips the password fields if the current_user is not an admin (and that part is functioning properly).

The edit form displays fine, and the forms’s fields are filled with the user being edited (not current_user) information.

The problem I’m having is that when I hit update, I get error messages telling me that the password is missing, etc.

I suspect that this has something to do with the edit form action (and perhaps something else).

Here’s what I have for form declaration in edit.html.erb (this is the original form declaration, when it was initially created by Devise, and it moved along with the file as I moved it to registrations and then to users view):

<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>

When I use firebug to see the form’s HTML, this is what I see:

<form id="new_user" class="new_user" method="post" action="/" accept-charset="UTF-8">

If I change registration_path to edit_user_path:

<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>

This is what I get in HTML:

<form id="new_user" class="new_user" method="post" action="/users/user/edit" accept-charset="UTF-8">

In addition, when I try to submit the form here, it tells me:

No route matches [PUT] "/users/user/edit"

In my users_controller.rb, I have the following (I deleted the edit and update methods from the registrations controller):

def edit
  @user = User.find(params[:id])
end
def update
  respond_to do |format|
    if @user.update_attributes(params[:user])
      format.html { redirect_to root_url, flash[:notice] = SUCCESSFUL_REGISTRATION_UPDATE_MSG }
      format.json { head :no_content }
    else
      format.html { render action: "edit" }
      format.json { render json: @user.errors, status: :unprocessable_entity }
    end
  end
end

FYI: Here’s what I see when I generate routes:

           edit_user GET    /users/:id/edit(.:format)      users#edit
                user GET    /users/:id(.:format)           users#show
                     PUT    /users/:id(.:format)           users#update
cancel_user_registration GET    /cancel(.:format)              registrations#cancel
   user_registration POST   /                              registrations#create
   new_user_registration GET    /request_invite(.:format)      registrations#new
  edit_user_registration GET    /edit(.:format)                registrations#edit
                         PUT    /                              registrations#update

Any ideas?

SOLUTION

In my case, and since I’m using update, the solution is to use update_without_password. If instead this is for new and I did not want to require a password, then it would be: save_without_password

def update
  @user = User.find(params[:id])
  respond_to do |format|
    if @user.update_without_password(params[:user])
      format.html { redirect_to root_url, flash[:notice] = SUCCESSFUL_REGISTRATION_UPDATE_MSG }
      format.json { head :no_content }
    else
      format.html { render action: "edit" }
      format.json { render json: @user.errors, status: :unprocessable_entity }
    end
   end
end  
  • 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-06-05T10:04:23+00:00Added an answer on June 5, 2026 at 10:04 am

    Keep in mind, your user model isn’t anything special just because devise is handling the logic. You can easily make a new controller/views for editing a users profile and give an admin access to it as well. (This is what I do, I don’t like the user having to enter their password to make any change at all)

    $ rails g controller users
    resources :users, :only => [:edit, :update]
    

    After that, it’s pretty much the same as any controller/views

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

Sidebar

Related Questions

I am kind of new to Rails and am struggling with an issue that
I am just new to programming in Unix and have a small issue that
I've a strange and new issue with an eclipse 3.5 rcp application: Everything worked
My application should execute some logic each time new issue is added to Jira.
I am new to MVC and facing one issue. I have a xml file
I`m new to sql and have been stuck on the following issue for almost
I'm new to LINQ and am having a small issue. I created a DBML
I'm fairly new to SVN and I have a weird behavior issue. I'm working
I've run into an issue with opening a new window in safari (both ipad
Hi I am new to android and I am having an issue I have

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.