0

我有这条路线:

  scope :module => :mobile, :as => :mobile do
    constraints(:subdomain => /m/) do
      devise_for :users, :path => "", :path_names =>
               { :sign_in => "login", :sign_out => "logout",
                 :sign_up => "signup" },
                 :controllers => {:sessions => "mobile/sessions"}
     ...

所以我想这将是我注销的链接:

  =link_to("Log Out", logout_url)

但这给出了错误:

undefined local variable or method `logout_url' for #<#<Class:0x134881e88>:0x134879a08>

知道如何让链接正确指向吗?

谢谢!

4

1 回答 1

4

如果您签出,rake routes您会注意到您的路线看起来像destroy_user_session.

此外,该路由仅在使用删除 http 方法时才有效。

link_to "Log out", destroy_user_session_url, :method => :delete

于 2012-04-24T14:48:23.263 回答