Created
December 4, 2013 10:14
-
-
Save Fire-Dragon-DoL/7785247 to your computer and use it in GitHub Desktop.
Easy way to handle empty passwords in devise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Never trust parameters from the scary internet, only allow the white list through. | |
| def user_params | |
| real_params = params.require(:user).permit(:email, :password, :password_confirmation, :role, :note) | |
| if real_params[:password].blank? | |
| real_params.delete(:password) | |
| real_params.delete(:password_confirmation) | |
| end | |
| real_params | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment