Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 路由错误:没有与[PATCH]匹配的路由/用户/登录;为设计更新密码_Ruby_Ruby On Rails 4_Devise - Fatal编程技术网

Ruby 路由错误:没有与[PATCH]匹配的路由/用户/登录;为设计更新密码

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

我正在尝试验证更新当前用户密码的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 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