设计路线错误

时间:2012-08-14 19:26:37

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

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

<%= 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

我怎样才能使用它?提前谢谢

1 个答案:

答案 0 :(得分:0)

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

<%= link_to "REGISTER", new_customer_registration_path %>