没有路由匹配[GET]“/ new_user_registration_path”

时间:2012-07-21 23:39:09

标签: ruby-on-rails devise

我正在创建一个简单的网站,用户可以在其中创建帐户并登录。从设计教程开始,我在application.html.haml中有这个:

%ul.nav
    -if user_signed_in?
        %li= link_to "Log out", "destroy_use_session_path", :method => :delete
        %li= link_to "Edit registration", "new_user_registration_path"
    -else
        %li= link_to "Log in", "new_user_session_path"
        %li= link_to "Register", "new_user_registration_path"

当我点击注册时,我收到此错误:

No route matches [GET] "/new_user_registration_path"

我对rails很新,这是我第一次使用devise,所以我确定它很简单,但我可以使用一些帮助。

1 个答案:

答案 0 :(得分:2)

路径应该没有引号:

%ul.nav
  -if user_signed_in?
    %li= link_to "Log out", destroy_use_session_path, :method => :delete
    %li= link_to "Edit registration", new_user_registration_path
  -else
    %li= link_to "Log in", new_user_session_path
    %li= link_to "Register", new_user_registration_path