Ruby 路由错误:没有与[PATCH]匹配的路由/用户/登录;为设计更新密码
我正在尝试验证更新当前用户密码的update_password api。我使用的是Desive,我的应用程序是SPA,前端有角度。当我尝试使用postman客户端验证api时,当前遇到此错误Ruby 路由错误:没有与[PATCH]匹配的路由/用户/登录;为设计更新密码,ruby,ruby-on-rails-4,devise,Ruby,Ruby On Rails 4,Devise,我正在尝试验证更新当前用户密码的update_password api。我使用的是Desive,我的应用程序是SPA,前端有角度。当我尝试使用postman客户端验证api时,当前遇到此错误 def update @user = User.find(current_user.id) if @user.update_with_password(user_params) # Sign in the user by passing validation in case their pa
def update
@user = User.find(current_user.id)
if @user.update_with_password(user_params)
# Sign in the user by passing validation in case their password changed
sign_in @user, :bypass => true
redirect_to root_path , notice: "Password was successfully changed"
else
# render "edit"
respond_to do |format|
format.html { redirect_to edit_user_registration_path, alert: @user.errors.full_messages.first.to_s }
end
# render "edit"
end
end
在我看来,您需要在Postman的标题中指定用户。您在Postman中列出的uri用于更新用户,但您的错误是没有用户登录路径,我认为这意味着它没有访问用户进行更新的权限 在您的terminal inside rails项目中执行
rake routes | grep sign_
,并发布输出。在您的问题中发布输出。评论部分用于讨论。新用户会话获取/用户/登录(:格式)设计/会话新用户会话发布/用户/登录(:格式)设计/会话创建v1登录页面url用户获取/用户/v1登录页面url(:格式)用户v1登录页面url