【发布时间】:2015-03-31 05:45:57
【问题描述】:
我的应用程序在 localhost 中运行良好,但在 Heroku 中运行时返回错误 500:内部服务器错误。它说:“我们很抱歉,但出了点问题。如果您是应用程序所有者,请查看日志以获取更多信息。”
我的 routes.rb 下有这个
get 'employees/showemployees'
resources :employees
这个,在我的控制之下
def showemployees
str = params[:str]
render json: @employee = Employee.where('fname LIKE ? OR lname LIKE ? OR mname LIKE ? OR username LIKE ? or id LIKE ?',
"%#{str}%","%#{str}%","%#{str}%", "%#{str}%", "%#{str}%")
结束
当我输入http://localhost:3000/employees/showemployees?str=samplename 它显示记录的 json 格式但是当我输入 https://dtitdtr.herokuapp.com/employees/showemployees?str=samplename 它将返回错误 500
heroku run rake db:migrate
已经完成了,还没有,
【问题讨论】:
-
查看 heroku 日志,
heroku addons:upgrade logging:expanded然后heroku logs --tail -
@Sontya 它说,未找到附加计划。
-
输入这个并查看错误
heroku logs -n 1000 -
@Sontya 它说,没有运算符匹配给定的名称和参数类型。您可能需要添加显式类型转换。
-
尝试删除,
id比较,然后查找 fname、lname、mname 和用户名
标签: ruby-on-rails ruby heroku internal-server-error