0

我今天才开始使用设计,我修改了 session#new.html.erb 文件以满足我的需要。我创建了一个名为 Register 的链接如下

<%= link_to "REGISTER", "new_customer_registration_path" %>

但是,当我单击链接时,它会将我引导至无路由错误

Routing Error
No route matches [GET] "/customers/new_customer_registration_path"

这是我的耙子路线

        new_customer_session GET    /customers/sign_in(.:format)         devise/sessions#new
            customer_session POST   /customers/sign_in(.:format)         devise/sessions#create
    destroy_customer_session DELETE /customers/sign_out(.:format)        devise/sessions#destroy
           customer_password POST   /customers/password(.:format)        devise/passwords#create
       new_customer_password GET    /customers/password/new(.:format)    devise/passwords#new
      edit_customer_password GET    /customers/password/edit(.:format)   devise/passwords#edit
                             PUT    /customers/password(.:format)        devise/passwords#update
cancel_customer_registration GET    /customers/cancel(.:format)          devise/registrations#cancel
       customer_registration POST   /customers(.:format)                 devise/registrations#create
   new_customer_registration GET    /customers/sign_up(.:format)         devise/registrations#new
  edit_customer_registration GET    /customers/edit(.:format)            devise/registrations#edit
                             PUT    /customers(.:format)                 devise/registrations#update
                             DELETE /customers(.:format)                 devise/registrations#destroy
                      events GET    /events(.:format)                    events#index
                             POST   /events(.:format)                    events#create
                   new_event GET    /events/new(.:format)                events#new
                  edit_event GET    /events/:id/edit(.:format)           events#edit
                       event GET    /events/:id(.:format)                events#show
                             PUT    /events/:id(.:format)                events#update
                             DELETE /events/:id(.:format)                events#destroy
                        root        /                                    events#index

我的路线文件他已经跟随

  devise_for :customers
  resources :events
  root :to => 'events#index'
  match '/new_customer_registration' => "devise/registrations#new"

我被重定向到发生错误的这个页面。

http://localhost:3000/customers/new_customer_registration_path

我该如何使用它?预先感谢

4

1 回答 1

0

它不应该是字符串,而是方法

<%= link_to "REGISTER", new_customer_registration_path %>
于 2012-08-14T19:28:54.987 回答