每次我在Heroku上运行应用程序时,这都是日志中的内容:
2018-04-15T22:51:12.806576+00:00 app[web.1]: I, [2018-04-15T22:51:12.806420 #4] INFO -- : [cd1ed367-c720-4568-ac03-a3b1bec4fc1b] Started GET "/patients" for 112.205.217.139 at 2018-04-15 22:51:12 +0000
2018-04-15T22:51:12.808307+00:00 app[web.1]: I, [2018-04-15T22:51:12.808235 #4] INFO -- : [cd1ed367-c720-4568-ac03-a3b1bec4fc1b] Processing by PatientsController#index as HTML
2018-04-15T22:51:12.811835+00:00 app[web.1]: I, [2018-04-15T22:51:12.811756 #4] INFO -- : [cd1ed367-c720-4568-ac03-a3b1bec4fc1b] Rendering patients/index.html.erb within layouts/application
2018-04-15T22:51:15.563600+00:00 heroku[router]: at=info method=GET path="/patients" host=jdent-patrec.herokuapp.com request_id=cd1ed367-c720-4568-ac03-a3b1bec4fc1b fwd="112.205.217.139" dyno=web.1 connect=0ms service=2757ms status=500 bytes=1827 protocol=https
2018-04-15T22:51:15.557887+00:00 app[web.1]: D, [2018-04-15T22:51:15.557726 #4] DEBUG -- : [cd1ed367-c720-4568-ac03-a3b1bec4fc1b] [1m[36mPatient Load (2.7ms)[0m [1m[34mSELECT "patients".* FROM "patients"[0m
2018-04-15T22:51:15.558988+00:00 app[web.1]: I, [2018-04-15T22:51:15.558899 #4] INFO -- : [cd1ed367-c720-4568-ac03-a3b1bec4fc1b] Rendered patients/index.html.erb within layouts/application (2747.0ms)
2018-04-15T22:51:15.559386+00:00 app[web.1]: I, [2018-04-15T22:51:15.559271 #4] INFO -- : [cd1ed367-c720-4568-ac03-a3b1bec4fc1b] Completed 500 Internal Server Error in 2751ms (ActiveRecord: 2589.2ms)
2018-04-15T22:51:15.560650+00:00 app[web.1]: F, [2018-04-15T22:51:15.560581 #4] FATAL -- : [cd1ed367-c720-4568-ac03-a3b1bec4fc1b]
2018-04-15T22:51:15.560736+00:00 app[web.1]: F, [2018-04-15T22:51:15.560661 #4] FATAL -- : [cd1ed367-c720-4568-ac03-a3b1bec4fc1b] ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "patients" does not exist
2018-04-15T22:51:15.560739+00:00 app[web.1]: LINE 1: SELECT "patients".* FROM "patients"
2018-04-15T22:51:15.560741+00:00 app[web.1]: ^
2018-04-15T22:51:15.560742+00:00 app[web.1]: : SELECT "patients".* FROM "patients"):
2018-04-15T22:51:15.561063+00:00 app[web.1]: F, [2018-04-15T22:51:15.560972 #4] FATAL -- : [cd1ed367-c720-4568-ac03-a3b1bec4fc1b] 22: </thead>
2018-04-15T22:51:15.561066+00:00 app[web.1]: [cd1ed367-c720-4568-ac03-a3b1bec4fc1b] 23:
2018-04-15T22:51:15.561067+00:00 app[web.1]: [cd1ed367-c720-4568-ac03-a3b1bec4fc1b] 24: <tbody>
2018-04-15T22:51:15.561069+00:00 app[web.1]: [cd1ed367-c720-4568-ac03-a3b1bec4fc1b] 25: <% @patients.each do |patient| %>
2018-04-15T22:51:15.561071+00:00 app[web.1]: [cd1ed367-c720-4568-ac03-a3b1bec4fc1b] 26: <tr>
2018-04-15T22:51:15.561072+00:00 app[web.1]: [cd1ed367-c720-4568-ac03-a3b1bec4fc1b] 27: <td><%= patient.id %></td>
2018-04-15T22:51:15.561074+00:00 app[web.1]: [cd1ed367-c720-4568-ac03-a3b1bec4fc1b] 28: <td><%= patient.first_name %></td>
2018-04-15T22:51:15.561133+00:00 app[web.1]: F, [2018-04-15T22:51:15.561061 #4] FATAL -- : [cd1ed367-c720-4568-ac03-a3b1bec4fc1b]
2018-04-15T22:51:15.561200+00:00 app[web.1]: F, [2018-04-15T22:51:15.561139 #4] FATAL -- : [cd1ed367-c720-4568-ac03-a3b1bec4fc1b] app/views/patients/index.html.erb:25:in `_app_views_patients_index_html_erb___2618543925626266733_38249580'
错误图片:
我一直在努力寻找问题好几天,但无济于事。
答案 0 :(得分:1)
我的下意识反应是没有为Heroku应用程序运行迁移。你最近创建了这张桌子吗?如果是这样,我会尝试heroku run rails db:migrate
。