All threads / Rails for Beginners Part 14: Handling Sign Up Errors Discussion

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Rails for Beginners Part 14: Handling Sign Up Errors Discussion

Love these Chris, noting some new tricks along the way. Plus your always positive demeanour makes this so enjoyable to go through.

Reply

If you're finding that you don't get 'Thanks!' back after setting up your create method, add local: true to your form.

Thanks for pointing that out, local: true resolves it

Hey! Where in the form are you adding the local: true, using sublime 3 and have tried plugging it in a few places? thank you!

Reply

I could not use @user.errors.any? in rails console.

but if I use [email protected]? Maybe it is my ruby version it is not the 3 but the 2.7... but my rails is 6.1.1 .
The error is in minute 6:37 <% if user = @user.errors.any? %>

Very sorry my wrong here. I did not saved the data bank so it was empty. Very sorry.

Reply

hi, when I click sign up nothing happens, why :( ?

Reply

Solution please!!!
when i create the account with already existing email ,, then it does not give an error.
already existing email validation is not working.

Currently we're only validating that each user instance has an email but we don't specify whether it should be unique or not:
https://guides.rubyonrails.org/active_record_validations.html#uniqueness

Reply

How can I translate the error message?

Reply

As others have pointed out, https://discuss.rubyonrails.org/t/rails-6-1-remote-forms-are-no-longer-default/76912 is a point of discussion with the difference on Rails 6.1 vs 6.0 (which i was using )

Reply

I'm also having the issue that the new view does not show the errors.
Render :new is called and @user.errors does have the correct errors.
Using Rails 6.1.3.1

Hotwire turbo was causing the problems for me.
adding 'data: { turbo: false }' to the form.submit made the form work like it should.

Reply

I'm getting an error that I can't seem to get past.
When submitting the form, I get:
'ActionController::ParameterMissing (param is missing or the value is empty: user'

I feel like something isn't correctly structured somewhere. Here is the output of my Params:
Parameters: {"authenticity_token"=>"[FILTERED]", "email"=>"travs", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "commit"=>"Create User"}.

Unlike in the video, my email, password, and password_confirmation are NOT wrapped insider a user param. Where does that happen??

I figured this out. In my form, i had @User while it was declared as @user

Reply
Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 48,086+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2021 GoRails, LLC. All rights reserved.