Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UndefinedTable error when trying to load suggested visits #263

Open
tchan09 opened this issue Sep 20, 2024 · 0 comments
Open

UndefinedTable error when trying to load suggested visits #263

tchan09 opened this issue Sep 20, 2024 · 0 comments

Comments

@tchan09
Copy link

tchan09 commented Sep 20, 2024

Describe the bug
On the beta visits page, clicking on the suggested button triggers an ActiveRecord error:

Showing /var/app/app/views/visits/_modal.html.erb where line #20 raised:

PG::UndefinedTable: ERROR:  relation "place_visits" does not exist
LINE 10:  WHERE a.attrelid = '"place_visits"'::regclass
                             ^

Trace of template inclusion: #<ActionView::Template app/views/visits/_visit.html.erb locals=["visit"]>, #<ActionView::Template app/views/visits/index.html.erb locals=[]>

Rails.root: /var/app

Version
0.14.1 via docker

To Reproduce
Steps to reproduce the behavior:

  1. Go to Visits page from the navigation tab
  2. Click on the 'Suggested' button
  3. See error

Expected behavior
I expect to suggested visits.

Logs
From dawarich_app:

17:17:46 web.1  | D, [2024-09-20T17:17:46.542368 #86] DEBUG -- :   User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
17:17:46 web.1  | D, [2024-09-20T17:17:46.542731 #86] DEBUG -- :   ↳ app/controllers/application_controller.rb:11:in `unread_notifications'
17:17:46 web.1  | D, [2024-09-20T17:17:46.544550 #86] DEBUG -- :   Visit Load (0.7ms)  SELECT "visits".* FROM "visits" WHERE "visits"."user_id" = $1 AND "visits"."status" = $2 ORDER BY "visits"."started_at" ASC  [["user_id", 1], ["status", 0]]
17:17:46 web.1  | D, [2024-09-20T17:17:46.544824 #86] DEBUG -- :   ↳ app/controllers/visits_controller.rb:15:in `group_by'
17:17:46 web.1  | D, [2024-09-20T17:17:46.548022 #86] DEBUG -- :   Visit Count (0.2ms)  SELECT COUNT(*) FROM "visits" WHERE "visits"."user_id" = $1 AND "visits"."status" = $2  [["user_id", 1], ["status", 0]]
17:17:46 web.1  | D, [2024-09-20T17:17:46.548209 #86] DEBUG -- :   ↳ app/controllers/visits_controller.rb:18:in `index'
17:17:46 web.1  | D, [2024-09-20T17:17:46.548603 #86] DEBUG -- :   Rendering layout layouts/application.html.erb
17:17:46 web.1  | D, [2024-09-20T17:17:46.548630 #86] DEBUG -- :   Rendering visits/index.html.erb within layouts/application
17:17:46 web.1  | I, [2024-09-20T17:17:46.551571 #86]  INFO -- : {"method":"GET","path":"/visits","format":"html","controller":"VisitsController","action":"index","status":500,"allocations":9653,"duration":11.15,"view":0.0,"db":1.77}
17:17:46 web.1  | F, [2024-09-20T17:17:46.552939 #86] FATAL -- :   
17:17:46 web.1  | ActionView::Template::Error (PG::UndefinedTable: ERROR:  relation "place_visits" does not exist
17:17:46 web.1  | LINE 10:  WHERE a.attrelid = '"place_visits"'::regclass
17:17:46 web.1  |                              ^
17:17:46 web.1  | ):
17:17:46 web.1  | 
17:17:46 web.1  | Causes:
17:17:46 web.1  | ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR:  relation "place_visits" does not exist
17:17:46 web.1  | LINE 10:  WHERE a.attrelid = '"place_visits"'::regclass
17:17:46 web.1  |                              ^
17:17:46 web.1  | )
17:17:46 web.1  | PG::UndefinedTable (ERROR:  relation "place_visits" does not exist
17:17:46 web.1  | LINE 10:  WHERE a.attrelid = '"place_visits"'::regclass
17:17:46 web.1  |                              ^
17:17:46 web.1  | )
17:17:46 web.1  |     17:              data-api_key="<%= current_user.api_key %>"
17:17:46 web.1  |     18:              data-controller="visit-modal-places"
17:17:46 web.1  |     19:              data-id="<%= visit.id %>">
17:17:46 web.1  |     20:           <% if visit.suggested_places.any? %>
17:17:46 web.1  |     21:             <%= select_tag :place_id,
17:17:46 web.1  |     22:                 options_for_select(
17:17:46 web.1  |     23:                   visit.suggested_places.map { |place| [place.name, place.id] },
17:17:46 web.1  |   
17:17:46 web.1  | D, [2024-09-20T17:17:46.553518 #86] DEBUG -- :   Rendering layout vendor/bundle/ruby/3.3.0/gems/actionpack-7.2.1/lib/action_dispatch/middleware/templates/rescues/layout.erb
17:17:46 web.1  | D, [2024-09-20T17:17:46.553544 #86] DEBUG -- :   Rendering vendor/bundle/ruby/3.3.0/gems/actionpack-7.2.1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout
17:17:46 web.1  | D, [2024-09-20T17:17:46.555291 #86] DEBUG -- :   Rendering vendor/bundle/ruby/3.3.0/gems/actionpack-7.2.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant