【We're sorry, but something went wrong.】エラーについて

実現したいこと

作成したアプリをRenderでデプロイしましたが
トップ画面は表示されるのですが、そこからユーザー新規登録または
ログイン画面へ行き、トップへリダイレクトしようとすると以下のエラーが出ます。
「We're sorry, but something went wrong.
If you are the application owner check the logs for more information.」

前提

トップ画面・ユーザー新規登録画面・ログイン画面の表示は問題ありません。

Log

Feb 16 02:58:29 PM D, [2023-02-16T05:58:29.159385 #69] DEBUG -- : [be4e2fe1-b428-42d3-987c-2d7f88711bc8] Tag Load (26.1ms) SELECT "tags".* FROM "tags" Feb 16 02:58:29 PM D, [2023-02-16T05:58:29.166742 #69] DEBUG -- : [be4e2fe1-b428-42d3-987c-2d7f88711bc8] Design Load (1.2ms) SELECT "designs".* FROM "designs" ORDER BY created_at DESC Feb 16 02:58:29 PM I, [2023-02-16T05:58:29.169686 #69] INFO -- : [be4e2fe1-b428-42d3-987c-2d7f88711bc8] Rendered collection of designs/_design.html.erb [0 times] (Duration: 0.0ms | Allocations: 3) Feb 16 02:58:29 PM I, [2023-02-16T05:58:29.169837 #69] INFO -- : [be4e2fe1-b428-42d3-987c-2d7f88711bc8] Rendered designs/index.html.erb within layouts/application (Duration: 38.7ms | Allocations: 2231) Feb 16 02:58:29 PM I, [2023-02-16T05:58:29.174886 #69] INFO -- : [be4e2fe1-b428-42d3-987c-2d7f88711bc8] Completed 200 OK in 71ms (Views: 13.3ms | ActiveRecord: 38.6ms | Allocations: 8989) Feb 16 02:58:31 PM I, [2023-02-16T05:58:31.575193 #69] INFO -- : [594c316e-ae4a-418e-9321-00f056c87d58] Started GET "/users/sign_in" for 141.101.86.129 at 2023-02-16 05:58:31 +0000 Feb 16 02:58:31 PM I, [2023-02-16T05:58:31.576171 #69] INFO -- : [594c316e-ae4a-418e-9321-00f056c87d58] Processing by Devise::SessionsController#new as HTML Feb 16 02:58:31 PM I, [2023-02-16T05:58:31.576237 #69] INFO -- : [594c316e-ae4a-418e-9321-00f056c87d58] Parameters: {"authenticity_token"=>"dCrOxxy17FTgOPfLmeUAV6rtAudr8vTj418xtlIKf1OCxPFy5l9ltxPowxtj5v1YVnLmUIfj+XYrUltpI8vMIQ=="} Feb 16 02:58:31 PM I, [2023-02-16T05:58:31.673270 #69] INFO -- : [594c316e-ae4a-418e-9321-00f056c87d58] Rendering devise/sessions/new.html.erb within layouts/application Feb 16 02:58:31 PM I, [2023-02-16T05:58:31.764818 #69] INFO -- : [594c316e-ae4a-418e-9321-00f056c87d58] Rendered devise/sessions/new.html.erb within layouts/application (Duration: 91.4ms | Allocations: 898) Feb 16 02:58:31 PM I, [2023-02-16T05:58:31.766410 #69] INFO -- : [594c316e-ae4a-418e-9321-00f056c87d58] Completed 200 OK in 190ms (Views: 95.5ms | ActiveRecord: 4.1ms | Allocations: 10099) Feb 16 02:58:45 PM I, [2023-02-16T05:58:45.471519 #69] INFO -- : [2bdc0678-606b-44e3-9c3b-34c1eabc2535] Started POST "/users/sign_in" for 141.101.86.129 at 2023-02-16 05:58:45 +0000 Feb 16 02:58:45 PM I, [2023-02-16T05:58:45.472400 #69] INFO -- : [2bdc0678-606b-44e3-9c3b-34c1eabc2535] Processing by Devise::SessionsController#create as HTML Feb 16 02:58:45 PM I, [2023-02-16T05:58:45.472487 #69] INFO -- : [2bdc0678-606b-44e3-9c3b-34c1eabc2535] Parameters: {"authenticity_token"=>"unph89ljiK24vsSEWaOQbQ339+EpGuMibqMPP9U81wNMlF5GI4kBTktu8FSjoG1i8WgTVsUL7remrmXgpP1kcQ==", "user"=>{"email"=>"it@abest.jp", "password"=>"[FILTERED]"}, "commit"=>"ログイン"} Feb 16 02:58:45 PM D, [2023-02-16T05:58:45.480719 #69] DEBUG -- : [2bdc0678-606b-44e3-9c3b-34c1eabc2535] User Load (1.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["email", "it@abest.jp"], ["LIMIT", 1]] Feb 16 02:58:45 PM I, [2023-02-16T05:58:45.486167 #69] INFO -- : [2bdc0678-606b-44e3-9c3b-34c1eabc2535] Completed 500 Internal Server Error in 14ms (ActiveRecord: 1.8ms | Allocations: 2798)

該当のソースコード

ruby

1config>routes.rb 2 3Rails.application.routes.draw do4 devise_for :users5 root to: 'designs#index'6 resources :users7 resources :designs8 resources :designs do9 collection do10 get 'search'11 end12 end13 resources :users, only: :show14 post '/designs/new', to: 'designs#create'15end16

ruby

1app>controllres>designs_controller 2 3class DesignsController < ApplicationController4 before_action :authenticate_user!, only:[:edit, :new, :destroy]5 before_action :move_to_index, except: [:index, :show]6 before_action :set_design, only: [:show, :edit, :update, :destroy]7 8 def index9 @designs = Design.includes(:user).order("created_at DESC")10 @designs = params[:tag_id].present? ? Tag.find(params[:tag_id]).designs : Design.all.order("created_at DESC")11 end12 13 def new14 @post_form = PostForm.new15 end16 17 def create18 @post_form = PostForm.new(design_params)19 20 if @post_form.save 21 redirect_to root_path 22 else23 render :new24 end25 end26 27 def show28 29 end30 31 def destroy32 design = Design.find(params[:id])33 if design.destroy 34 redirect_to root_path 35 end36 end37 38 def update39 design = Design.find(params[:id])40 if41 design.update(design_params)42 redirect_to design_path(design.id)43 else44 redirect_to request.referer 45 end46 end47 48 def edit49 unless user_signed_in? && current_user.id == @design.user_id 50 redirect_to action: :index51 end52 end53 54 def search55 @designs = Design.search(params[:keyword]).order("created_at DESC")56 end57 58 59 60 private61 62 def design_params63 params.require(:post_form).permit(:title, :file_name, :tag_name, :image).merge(user_id: current_user.id)64 end65 66 def set_design67 @design = Design.find(params[:id])68 end69 70 def move_to_index71 unless user_signed_in?72 redirect_to action: :index73 end74 end75 76end77 78

ruby

1app>controllres>users_controller 2 3class UsersController < ApplicationController4 5 def show6 user = User.find(params[:id])7 @name = user.name 8 @designs = user.designs 9 end10 11end12

試したこと

routesがおかしいのかと色々試してみましたが、改善されませんでした。
「 Completed 500 Internal Server Error」の上に「Users」とあるので
user関連かとこちらも変更してみましたが変化ありませんでした。

コメントを投稿

0 コメント