ruby on rails - Pass Reset - No route matches [PATCH] "/password_resets.SOLceKJXoax55zSBAfAhTQ" -
i'm doing michael hartl rails tutorial , trying implement password reset functionality request sends password reset form (the form reset password) looks /password_resets.solcekjxoax55zsbafahtq rails says: no route matches [patch] "/password_resets.solcekjxoax55zsbafahtq" in tutorial asked use route: resources :password_resets, only: [:new, :create, :edit, :update] error message.
this how password_resets_controller.rb update method looks like:
def update if password_blank? flash.now[:danger] = "password can't blank" render 'edit' elsif @user.update_attributes(user_params) log_in @user flash[:success] = "password has been reset." redirect_to @user else render 'edit' end end
any idea how method or route causing error? thank in advance.
update: adding reset password view (password_resets\edit.html.erb)
<% provide(:title, 'reset password') %> <h1>reset password</h1> <div class="row"> <div class="col-md-6 col-md-offset-3"> <%= form_for(@user, url: password_resets_path(params[:id])) |f| %> <%= render 'shared/error_messages' %> <%= hidden_field_tag :uemail, @user.uemail %> <%= f.label :password %> <%= f.password_field :password, class: 'form-control' %> <%= f.label :password_confirmation, "confirmation" %> <%= f.password_field :password_confirmation, class: 'form-control' %> <%= f.submit "update password", class: "btn btn-primary" %> <% end %> </div> </div>
change this:
<%= form_for(@user, url: password_resets_path(params[:id])) |f| %>
to this:
<%= form_for(@user, url: password_reset_path(params[:id])) |f| %>
Comments
Post a Comment