0

我刚刚升级到 rails3.2.8和 devise 2.1.2,完全擦除了我的 User 模型以使用新的迁移和设置。不过,我保留了我的旧观点并开始测试我的用户链接以销毁/删除他们自己的帐户。现在我在 Firefox 中对此进行了测试,它没有错误,打开确认框并在确认后删除帐户。在谷歌浏览器中,虽然我没有得到确认框,但它直接进入:

Routing Error
No route matches [GET] "/users"

这是我的链接,应该是:

  Unhappy? <%= link_to "Delete my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>.

还有人有这种疯狂吗?为什么它不适用于此浏览器?

4

2 回答 2

1

你应该看到:

edit_user_registration   GET    /users/edit(.:format)            devise/registrations#edit
                         PUT    /users(.:format)                 devise/registrations#update
                         DELETE /users(.:format)                 devise/registrations#destroy

当您在项目目录中运行“rake routes”时。

尝试更改"user_registration_path""edit_user_registration_path"

于 2012-08-31T03:48:50.297 回答
0

必须更改我的路线才能正确。

devise_for :users, :controllers => { :registrations => 'registrations' }
  devise_scope :user do
    get 'join' => 'devise/registrations#new', :as => :new_user_registration
    put 'join' => 'devise/registrations#create', :as => :user_registration
    get 'login' => 'devise/sessions#new', :as => :new_user_session
    post 'login' => 'devise/sessions#create', :as => :user_session
    delete 'logout' => 'devise/sessions#destroy', :as => :destroy_user_session
    get 'account_settings' => 'devise/registrations#edit', :as => :edit_user_registration
    put 'account_settings' => 'devise/registrations#update', :as => :update_user_registration
    get 'forgot_password' => 'devise/passwords#new', :as => :new_user_password
    get 'user', :to => 'user_pages#home', :as => :user_root
  end

  match '/user' => 'user_pages#home', :as => :user_root

并添加到列表中:

delete 'join' => 'devise/registrations#destroy', :as => :user_registration

也可能是我从头开始重新编写了整个应用程序。

于 2012-09-18T20:59:56.130 回答