Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/54.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 on rails 为什么可以';我不能在Heroku上删除我的web应用程序中的用户帐户吗?_Ruby On Rails - Fatal编程技术网

Ruby on rails 为什么可以';我不能在Heroku上删除我的web应用程序中的用户帐户吗?

Ruby on rails 为什么可以';我不能在Heroku上删除我的web应用程序中的用户帐户吗?,ruby-on-rails,Ruby On Rails,我正在开发我的第一个Rails应用程序,我是一个初学者程序员。我允许注册我的应用程序的人做的一件事就是删除他们的帐户。现在,我可以删除我在本地环境中创建的帐户,但是在Heroku上,当我尝试删除用户帐户时,我会收到一个错误,上面写着“出了问题”。以下是我认为相关的所有代码: 在routes.rb中删除我的帐户路由: match '/delete_account', to: 'users#destroy' 在users\u controller.rb中我的销毁方法: def destroy

我正在开发我的第一个Rails应用程序,我是一个初学者程序员。我允许注册我的应用程序的人做的一件事就是删除他们的帐户。现在,我可以删除我在本地环境中创建的帐户,但是在Heroku上,当我尝试删除用户帐户时,我会收到一个错误,上面写着“出了问题”。以下是我认为相关的所有代码:

在routes.rb中删除我的帐户路由:

match '/delete_account', to: 'users#destroy'
在users\u controller.rb中我的销毁方法:

  def destroy
    @user = User.find(params[:id])
    cu = Stripe::Customer.retrieve(@user.stripe_customer_token)
    cu.delete
    @user.destroy
    flash[:success] = "Your account has been deleted."
    redirect_to root_path
  end
app/views/users/edit.html.erb中的我的链接:

    <%= link_to 'Delete Account', @user, confirm: 'Are you sure?', method: :delete %>


当我检查Heroku日志时,没有错误。我能找到的唯一错误是没有加载favicon.ico文件的路径。如果你能帮我解决这个问题,并帮助我在我的应用程序中使用功能,用户可以删除自己,我将非常感激。

你的页面中是否包含rails js?
@user
不是路径,你会得到什么html?旁注,您的条带标记删除应在模型的callback@apneadiving我想我的页面中包含了rails.js。我一直在使用命令“bundle exec rake assets:precompile”为Heroku预编译我的资产,然后将编译后的资产添加到我的git repo中。这会对它产生影响吗?对于单击链接时的html输出,我得到的只是我的Heroku应用程序上的错误消息,但在我的本地环境中,路径完成了预期的任务。@user1483441您是否找到了此问题的解决方案。。。。?