Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby

Any idea how to fix this? NoMethodError in Devise::Registrations#new

Anyone have any idea how to fix this error when I go to localhost:3000/users/sign_up ?

undefined method `registration_path'

Below is the line of code it highlights in pink on the error page. It's from apps/views/devise/new.html

<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>

Thank you for your time, Eric

4 Answers

Well your code seems to be right. So what you need to do is reboot your rails server and try it again. It should work now. If it doesn't then try

rake db:reset

and then

rake db:migrate

If it still doesn't work then please check out this link and try the methods given.

Awesome! The rails server restart worked like a charm!! Thank you very much! -Eric

I am glad I could help you :)

Nathan Young
Nathan Young
2,466 Points

I know this is old but I wanted to also say thank you for the help . Reset sever worked.

Hi @Eric,

Can you please post your rake routes

Absolutely. Here they are. Thank you so much for taking a look.

computer:treebook admin$ rake routes
                  Prefix Verb   URI Pattern                    Controller#Action
        new_user_session GET    /users/sign_in(.:format)       devise/sessions#new
            user_session POST   /users/sign_in(.:format)       devise/sessions#create
    destroy_user_session DELETE /users/sign_out(.:format)      devise/sessions#destroy
           user_password POST   /users/password(.:format)      devise/passwords#create
       new_user_password GET    /users/password/new(.:format)  devise/passwords#new
      edit_user_password GET    /users/password/edit(.:format) devise/passwords#edit
                         PATCH  /users/password(.:format)      devise/passwords#update
                         PUT    /users/password(.:format)      devise/passwords#update
cancel_user_registration GET    /users/cancel(.:format)        devise/registrations#cancel
       user_registration POST   /users(.:format)               devise/registrations#create
   new_user_registration GET    /users/sign_up(.:format)       devise/registrations#new
  edit_user_registration GET    /users/edit(.:format)          devise/registrations#edit
                         PATCH  /users(.:format)               devise/registrations#update
                         PUT    /users(.:format)               devise/registrations#update
                         DELETE /users(.:format)               devise/registrations#destroy
                statuses GET    /statuses(.:format)            statuses#index
                         POST   /statuses(.:format)            statuses#create
              new_status GET    /statuses/new(.:format)        statuses#new
             edit_status GET    /statuses/:id/edit(.:format)   statuses#edit
                  status GET    /statuses/:id(.:format)        statuses#show
                         PATCH  /statuses/:id(.:format)        statuses#update
                         PUT    /statuses/:id(.:format)        statuses#update
                         DELETE /statuses/:id(.:format)        statuses#destroy
                    root GET    /                              statuses#index

Thanks again for your help! I am stuck, so I appreciate your time.

Well your code seems to be right. So what you need to do is reboot your rails server and try it again. It should work now. If it doesn't then try

rake db:reset

and then

rake db:migrate

If it still doesn't work then please check out this link and try the methods given.