Chapter 12 is all about adding a way to reset password. In the beginning we create a controller called PasswordResets.
For the create action, the method is defined as:
def create
@user = User.find_by(email: params[:password_reset][:email].downcase)
if @user
@user.create_reset_digest
@user.send_password_reset_email
flash[:info] = "Email sent with password reset instructions"
redirect_to root_url
else
flash.now[:danger] = "Email address not found"
render 'new'
end
end
My question is: how is the key [:password_reset] for params created? Was it always there and did we do something to make it present?
Params is something I find a bit confusing and can't get my head around!