Ask A Question

Notifications

You’re not receiving notifications from this thread.

Rails for Beginners Part 20: Forgot Your Password Discussion

Hi Chris, is there a particular reason the create a different controller for each route action?

Reply

I think it is for code modular, in this case I tried to implement reset password and forgot password in the same controller, but I noticed forgot password is not under before_action: needs_logged_in, so I ended up making another controller like the tuto.

Reply

I'm at a complete loss as to the difference between Current.user and @user, and when to use which one. Can anyone shed light on that for me? Thanks.

Reply

Ahhh. Took a while but I eventually realized that if you forgot your password you aren't logged in, there isn't a session cookie, and Current.user isn't of any use. Duh. :-/

Reply

thanks to ur comment

Reply

Current.user is a SupportAttribute that helps us to avoid searching our user all the time, he only declares set_current_user( this method assigns the value of Current.user), but with SupportAttribute, this variable is converted into a global variable.

Reply

Thanks for your comment, helped me realize that too.

Reply

I really these love this series

Reply

nice

Reply

Thank you very much, Chris! I'm learning a lot. It doesn't feel like it's only an 8 min video. You can deliver a huge amount of useful information in a few minutes.

Reply

I'm getting a
Routing Error
No route matches [POST] "/password/reset" when I click on the reset password button. I can see that I do have the route.

1)password_reset GET /password/reset(.:format) password_resets#new
2)pasword_reset POST /pasword/reset(.:format) password_resets#create

Reply

Hi , I hope you have figured it out by now, you have a spelling mistake in POST request - it should be "paSSword' not "paSword".

Reply
Join the discussion
Create an account Log in

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

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

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