Title: Add CRUD logic to Devise Date: 21 August 2011 URL: https://ralovely.com/blog/2011/08/21/devise-crud/ Author: Raphael Campardou Archived: yes --- This is an old post, kept here for posterity. Some links may be broken, opinions may have changed, and technology has certainly moved on. --- If your app authentication is handled by Devise, and you want to be able to administer your users' account in your app, you'll need a CRUD controller and the associated views. Devise's wiki has a lot of resources, including this one: [How-To:-Manage-users-through-a-CRUD-interface](https://github.com/plataformatec/devise/wiki/How-To:-Manage-users-through-a-CRUD-interface). (I since edited the page to reflect these changes). I found out that it needs a little correction and an addendum. * The path_prefix in the routes file is not optional. If you don't add it, rails will mix up edit routes. * In your controller's update method, you need to check if the password is blank. If so, remove the key from the hash. If not, Devise will fail its validations. ```ruby if params[:user][:password].blank? params[:user].delete(:password) params[:user].delete(:password_confirmation) end ``` --- For the humans reading the machine-readable version: hello. You're thorough. I appreciate that.