Dionna Morris
Dionna Morris

Reputation: 11

(Ruby on Rails) - NoMethodError in Devise

I'm doing the four hour course on Ruby on Rails on YouTube from FreeCodeCamp and am struggling around 1:57:00 in the video. During this part of the course we added the Devise gem and are adding a Sign Up, Sign Out, and Edit Profile links to our nav bar. I double checked my code and re-watched this part of the video several times now, but when I go to 'sign up' on the site via local host this error shows in the browser:

NoMethodError in Devise::RegistrationsController#create

     if options.empty?
                  recipient.public_send(method, *args)
                else
                  recipient.public_send(method, *args, options)
                end

And this message pops up on the terminal:

NoMethodError (undefined method `user_url' for #<Devise::RegistrationsController:0x0000000000c9e0>

              recipient.public_send(method, *args)
                       ^^^^^^^^^^^^):

Following this is a ton of actionpack, activesupport, responders, etc lines. Just looking to see if anyone can help me and explain exactly what's wrong so I can fix it.

Upvotes: 1

Views: 1690

Answers (2)

zaheed
zaheed

Reputation: 21

modify below files

app/views/devise/registrations/new.html.erb

<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { data: { turbo: false} } ) do |f| %>

app/views/devise/sessions/new.html.erb

<%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { data: { turbo: false} } ) do |f| %>

ref: GitHub Issue

Upvotes: 2

abster2012
abster2012

Reputation: 9

I'm not sure if you're still having this issue. Like zaheed pointed out above, it seems like the error is likely coming from views/home/_header.html.erb, specifically the new_user_session_path part of the list form block mentioned in the video.

Upvotes: 0

Related Questions