我遵循了这个设计how to: Redirect to a specific page on successful sign up。
我创建了一个新的RegistrationsController
class RegistrationsController < Devise::RegistrationsController
def after_inactive_sign_up_path_for(resource)
...
end
def destroy
logger.debug 'destroy user'
...
end
end
我更改了routes.rb:
devise_for :users, :controllers => { :registrations => "registrations" } do
get 'users', :to => 'profile#index', :as => :user_root
end
并在我的新RegistrationsController下移动devise/registrations/
次观看。
rake routes
我有:
DELETE /users(.:format) {:action=>"destroy", :controller=>"registrations"}
after_inactive_sign_up_path_for
正在发挥作用。
但destroy
操作不起作用:我取消帐户时
<%= button_to "Cancel my account", registration_path(resource_name), :confirm => "ok?", :method => :delete %>
我有以下错误:
The action 'destroy' could not be found for RegistrationsController
我使用Devise 1.4.5&amp; Rails 3.1
答案 0 :(得分:0)
我刚遇到同样的问题。将destroy方法移动到控制器的非私有部分修复它。