2011-11-10 39 views
1

我遵循這個設計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

我用設計1.4.5 &的Rails 3.1

回答

0

我剛碰到同樣的問題。將銷燬方法移動到控制器的非專用部分對其進行修復。