我想我会在这里发布这个,因为它有望节省其他人跟踪每个提交以查看问题所在的时间。我已经有几个星期没有推送到 heroku 了,当我这样做时,应用程序崩溃了,并显示了 500 条 html 消息。没有比这更多的信息,而且日志没有任何帮助。没有什么不寻常的,也没有什么不寻常的。解决方案是什么?
问问题
109 次
1 回答
0
控制器中未实现的方法,我在未实现的控制器中添加了新方法,方法中没有模板或代码,如果您的 heroku 推送失败检查,它会在应用程序的每个页面上导致 500 错误所有未实现方法的控制器:
class ContactTablesController < ApplicationController
before_action :signed_in_user
# respond_to :html, :js
# def new #I added this to implement it later, started doing something else
# end # and forgot about it, uncommenting these lines brings the entire heroku app
# down resulting in 500 errors
def create
# pp params[:contact_table] + " create"
@user = User.find(params[:contact_table][:contact_id])
current_user.add_contact!(@user)
respond_to do |format|
format.html { redirect_to @user }
format.js
end
end
def destroy
# pp params[:contact_table] + " destroy"
@user = ContactTable.find(params[:id]).contact
@id = ContactTable.where('user_id is ? AND contact_id is ?', current_user.id, @user.id).first.id
current_user.remove_contact!(@user)
respond_to do |format|
format.html { redirect_to @user }
format.js
end
end
end
我意识到很多人可能知道会发生这种情况,但我没有,并且花了一段时间浏览代码才注意到它。希望它可以帮助别人。
于 2013-06-27T16:35:32.587 回答