Eric Halverson

Joined

1,460 Experience
14 Lessons Completed
0 Questions Solved

Activity

There is a 'Next Arrow' ( > ) at the top right of the page that will take you to the next video in the series but I prefer to start from 'https://gorails.com/start' where you can see all of the videos in the series and then right click and open each new video on a new tab and then close after finishing the video and then going back to the list and click on the next video.

Using Rails 7: I was able to get "Thanks!" and params[:user] to render using the changes that Martin suggested: (Thank you Martin! : ) )

<%= form.submit "Sign Up", data: { turbo: false }, class: "btn btn-primary"%>

and on your form_with add local:true like this:
<%= form_with model: @user, url: sign_up_path, local: true do |form| %>

I had to restart the rails server after saving the changes for it to work : )

Of course, the point is to get the user registration to write to the database but it's nice to follow along and get the same results that Chris is getting : )

We get to the 'Sign up' form from the registrations_controller#new action which defines the @user instance variable as User.new (calling the new method on the User model). Because we use an instance variable in the controller, it is available to be used in the 'View' (new.html.erb) where we create the form. form_with is a form helper that will generate a form tag and create a 'POST' action when submitted to the URL that we define, which, in this case is routed to our registrations_controller#create action which will create a new user in the database using the fields that are passed to it in the form fields (email, password, password_confirmation) : )

This line is already in the Gemfile at around line 37:
gem "bcrypt", "~> 3.1.7"

You just need to uncomment it and then run bundle. Did you try this? : )

Thanks for the resource link! : )

Ditto what @Jerry said! : )

logo Created with Sketch.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2022 GoRails, LLC. All rights reserved.