Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Alexander Ramadan
Alexander Ramadan
3,283 Points

NoMethodError in Devise/registrations#new error

I'm at the point where I am trying to access 'users/sign_up' but I am getting the a 'NoMethodError in Devise/registrations#new' error. I get this on all the new paths I've checked.

I've run "rake db:rollback" and then "rake db:migrate" to try to fix it but that doesn't seem to work.

Any help?

10 Answers

Got the same issue like you, Alexander! It seems that you need to reboot rails server to append the changes - at least worked for me. Have you tried that?

jmt
jmt
13,877 Points

try "rake db:reset"

Alexander Ramadan
Alexander Ramadan
3,283 Points

No luck, getting the same error.

More of the error if it helps,

Showing /usr/local/rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/app/views/devise/registrations/new.html.erb where line #3 raised:

undefined method `registration_path' for #<#<Class:0x007fc48b855f28>:0x007fc48baf6368> Extracted source (around line #3):

1: <h2>Sign up</h2> 2: 3: <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> 4: <%= devise_error_messages! %> 5: 6: <div><%= f.label :email %><br />

Is there an order I should run them in, "reset", "rollback", and "migrate" that is.

jmt
jmt
13,877 Points

Hmm...I'm not sure, I had this issue for a while as well, "rake db:reset" finally fixed it for me.

Also, I don't know if this would matter, but is your "Sign Up" inside the header tags?

<h1></h1>
Luke Ward
Luke Ward
9,154 Points

Have you tried rake routes to see the actual route of the page? Have you edited anything in your routes.rb?

Alexander Ramadan
Alexander Ramadan
3,283 Points

Yep, ran rake routes. I haven't changed anything in routes.rb that I wasn't instructed to. Ill double check though.

Luke Ward
Luke Ward
9,154 Points

Have you ran generate devise views?

Alexander Ramadan
Alexander Ramadan
3,283 Points

Yes, would I need to run it again after db:reset or db:rollback?

When I run rake routes I can see all the views like /users/sign_up

Alexander Ramadan
Alexander Ramadan
3,283 Points

Okay, I don't know what happened but when I booted up this evening everything seems to be working.

Thanks for the help!

I found it works by using

rake db:rollback and rake db:reset up until your table is cleared, then migrate it again using rake db:migrate

Cheers