我尝试 https://salty-wave-17330.herokuapp.com/users 我收到错误消息 很抱歉,出了点问题.如果您是应用程序 所有者检查日志以获取更多信息.服务器日志, https://bitbucket.org/Marium36/toy_app/src/master/heroku_server_logs 显示的持续错误消息是Users不存在---但确实存在,我可以在本地计算机中加载localhost:3000/users 请帮助!!! 2019-06-29T11:24:46.008853+00:00 app[web.1]: I, [2019-06-29T11:24:46.008752 #4] INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Started GET "/users" for PRIVATE_IP at 2019-06-29 11:24:46 +00002019-06-29T11:24:46.010267+00:00 app[web.1]: I, [2019-06-29T11:24:46.010188 #4] INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Processing by UsersController#index as HTML2019-06-29T11:24:46.013170+00:00 app[web.1]: I, [2019-06-29T11:24:46.013098 #4] INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Rendering users/index.html.erb within layouts/application2019-06-29T11:24:46.055431+00:00 app[web.1]: D, [2019-06-29T11:24:46.055315 #4] DEBUG -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] User Load (1.5ms) SELECT "users".* FROM "users"2019-06-29T11:24:46.056103+00:00 app[web.1]: I, [2019-06-29T11:24:46.056041 #4] INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Rendered users/index.html.erb within layouts/application (42.8ms)2019-06-29T11:24:46.056339+00:00 app[web.1]: I, [2019-06-29T11:24:46.056280 #4] INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Completed 500 Internal Server Error in 46ms (ActiveRecord: 13.4ms)2019-06-29T11:24:46.057108+00:00 app[web.1]: F, [2019-06-29T11:24:46.057045 #4] FATAL -- : [5d839ee1-e92f-46d7-81d0-9fd508157239]2019-06-29T11:24:46.063287+00:00 app[web.1]: F, [2019-06-29T11:24:46.057141 #4] FATAL -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "users" does not exist解决方案 PG::UndefinedTable: ERROR表示您尚未创建表.您需要运行heroku run rake db:migrate,以便将表添加到您的Heroku Postgres.I am following Ruby On Rails Book Tutorial, Chapter 2, toy_appRepository is on BitBucket, https://bitbucket.org/Marium36/toy_app/So far, I can open the app on my local server, i.elocalhost:3000 and localhost:3000/usersProblem arises with heroku. Heroku app can only open https://salty-wave-17330.herokuapp.com/As soon as I attempthttps://salty-wave-17330.herokuapp.com/usersI get error, We're sorry, but something went wrong. If you are the application owner check the logs for more information.Server logs, https://bitbucket.org/Marium36/toy_app/src/master/heroku_server_logsThe continual error message that shows is that Users does not exist --- but it does, I can load in my local machine, i.e. localhost:3000/usersPlease help!!!2019-06-29T11:24:46.008853+00:00 app[web.1]: I, [2019-06-29T11:24:46.008752 #4] INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Started GET "/users" for PRIVATE_IP at 2019-06-29 11:24:46 +00002019-06-29T11:24:46.010267+00:00 app[web.1]: I, [2019-06-29T11:24:46.010188 #4] INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Processing by UsersController#index as HTML2019-06-29T11:24:46.013170+00:00 app[web.1]: I, [2019-06-29T11:24:46.013098 #4] INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Rendering users/index.html.erb within layouts/application2019-06-29T11:24:46.055431+00:00 app[web.1]: D, [2019-06-29T11:24:46.055315 #4] DEBUG -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] User Load (1.5ms) SELECT "users".* FROM "users"2019-06-29T11:24:46.056103+00:00 app[web.1]: I, [2019-06-29T11:24:46.056041 #4] INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Rendered users/index.html.erb within layouts/application (42.8ms)2019-06-29T11:24:46.056339+00:00 app[web.1]: I, [2019-06-29T11:24:46.056280 #4] INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Completed 500 Internal Server Error in 46ms (ActiveRecord: 13.4ms)2019-06-29T11:24:46.057108+00:00 app[web.1]: F, [2019-06-29T11:24:46.057045 #4] FATAL -- : [5d839ee1-e92f-46d7-81d0-9fd508157239]2019-06-29T11:24:46.063287+00:00 app[web.1]: F, [2019-06-29T11:24:46.057141 #4] FATAL -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "users" does not exist 解决方案 PG::UndefinedTable: ERROR means you haven't created the table. You need to run heroku run rake db:migrate so that the tables are added to your Heroku Postgres. 这篇关于Heroku Ruby On Rails服务器日志显示“用户"不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-26 11:23