現在ECサイトを作成しています。
Deviseを利用してユーザーの退会機能を実装したいのですがルーティングエラーによりうまくいきません(m_ m)
わかる方がいらっしゃれば教えていただきますようよろしくお願いいたします(m _m)
疑問
- 退会機能はregistrations#destroyアクションで良いのか?
- 下記のルーティングの場合は
method: :delete
で良いのか?
###エラー内容
No route matches [DELETE] "/users/edit"
###期待する動作
ユーザーの退会処理ができるようにしたい
###動作環境
OS:mac
Ruby:2.3.5
Ruby on Rails: 4.2.10
MySQL: 5.7.18
devise(gem):4.4.0
bootstrap3
###参考サイト
deviseのユーザー退会時に論理削除する
config/routes.rb
ruby
1. 2. 3 devise_for :users, controllers: { 4 sessions: 'public/settings/users/sessions', 5 passwords: 'public/settings/users/passwords', 6 registrations: 'public/settings/users/registrations', 7 omniauth_callbacks: 'public/settings/users/omniauth_callbacks' 8 } 9. 10.
registrations_controller.rb
ruby
1 def destroy 2 super 3 end
app/views/public/settings/users/dashboard.html.erb
ruby
1<%= link_to(edit_user_registration_path(id: current_user.id), method: :delete, class: 'content col-md-4 col-md-offset-1') do %> 2 <strong>退会する</strong> 3 <% end %> 4</div>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。