Skip to content

Instantly share code, notes, and snippets.

@Fire-Dragon-DoL
Created December 4, 2013 10:14
Show Gist options
  • Select an option

  • Save Fire-Dragon-DoL/7785247 to your computer and use it in GitHub Desktop.

Select an option

Save Fire-Dragon-DoL/7785247 to your computer and use it in GitHub Desktop.
Easy way to handle empty passwords in devise
# 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