From 973752a736dc1a0f50648f90bb8979d011268057 Mon Sep 17 00:00:00 2001 From: Nixon Date: Wed, 16 Feb 2022 23:04:50 -0300 Subject: [PATCH] fix close my account button --- lib/generators/authentication/authentication_generator.rb | 2 +- .../templates/controllers/api/cancellations_controller.rb.tt | 2 +- .../templates/controllers/html/cancellations_controller.rb.tt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/generators/authentication/authentication_generator.rb b/lib/generators/authentication/authentication_generator.rb index 16f6e8b..717c180 100644 --- a/lib/generators/authentication/authentication_generator.rb +++ b/lib/generators/authentication/authentication_generator.rb @@ -38,7 +38,7 @@ def create_migrations def add_routes route "resource :password_resets, except: [:show, :destroy]" - route "resource :cancellations, only: [:new, :destroy]" + route "resource :cancellations, only: [:new, :create]" route "resource :passwords, only: [:update, :edit]" route "delete 'sign_out', to: 'sessions#destroy'" route "post 'sign_up', to: 'registrations#create'" diff --git a/lib/generators/authentication/templates/controllers/api/cancellations_controller.rb.tt b/lib/generators/authentication/templates/controllers/api/cancellations_controller.rb.tt index 0dba20f..15d46fa 100644 --- a/lib/generators/authentication/templates/controllers/api/cancellations_controller.rb.tt +++ b/lib/generators/authentication/templates/controllers/api/cancellations_controller.rb.tt @@ -1,5 +1,5 @@ class CancellationsController < ApplicationController - def destroy + def create Current.<%= singular_table_name %>.destroy end end diff --git a/lib/generators/authentication/templates/controllers/html/cancellations_controller.rb.tt b/lib/generators/authentication/templates/controllers/html/cancellations_controller.rb.tt index b760e5f..7b3b1c6 100644 --- a/lib/generators/authentication/templates/controllers/html/cancellations_controller.rb.tt +++ b/lib/generators/authentication/templates/controllers/html/cancellations_controller.rb.tt @@ -2,7 +2,7 @@ class CancellationsController < ApplicationController def new end - def destroy + def create Current.<%= singular_table_name %>.destroy redirect_to sign_in_path, notice: "Bye! Your account has been successfully cancelled" end