Search code examples
ruby-on-railsruby-on-rails-3ruby-on-rails-3.1devise

Devise route error


I just started using devise today and i modify session#new.html.erb file to fit my needs. I created a link called Register has follow

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

However when i click on the link it direct me to a no route errors

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

Here my rake routes

        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

My route file his has follow

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

I get redirect to this page where the error occurs.

http://localhost:3000/customers/new_customer_registration_path

How can i use it?? Thank in advance


Solution

  • it should not be a string but method

    <%= link_to "REGISTER", new_customer_registration_path %>