为什么我的删除链接不适用于Google Chrome?

时间:2012-08-31 02:07:10

标签: ruby-on-rails ruby-on-rails-3 devise

我刚刚升级到rails 3.2.8并设计了2.1.2,完全擦除了我的用户模型以使用新的迁移和设置。我保留了我的旧观点,并开始测试我的用户链接以销毁/删除自己的帐户。现在我在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 %>.

其他人有这种疯狂吗?为什么它对这个浏览器不起作用?

2 个答案:

答案 0 :(得分: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"

答案 1 :(得分: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

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