From 27274521e5d0e706773c9efb16918b09f813bf41 Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Wed, 10 Apr 2024 20:57:37 +0900 Subject: [PATCH] =?UTF-8?q?=E8=A9=B2=E5=BD=93=E7=95=AA=E7=B5=84=E3=81=8C?= =?UTF-8?q?=E8=A6=8B=E3=81=A4=E3=81=8B=E3=82=89=E3=81=AA=E3=81=8B=E3=81=A3?= =?UTF-8?q?=E3=81=9F=E5=A0=B4=E5=90=88=E3=81=AF=20flash=20=E3=83=A1?= =?UTF-8?q?=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=82=92=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/podcasts_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/podcasts_controller.rb b/app/controllers/podcasts_controller.rb index 3917ec368..fc19f15a5 100644 --- a/app/controllers/podcasts_controller.rb +++ b/app/controllers/podcasts_controller.rb @@ -19,7 +19,10 @@ def index def show @episode = Podcast.find_by(id: params[:id]) - redirect_to root_url unless @episode.exists? + if @episode.nil? + flash[:warning] = '該当する番組が見つかりませんでした 💦' + return redirect_to podcasts_path + end @title = @episode.title.split('-').last.strip @date = @episode.published_date.strftime("%Y年%-m月%-d日(#{Podcast::WDAY2JAPANESE[@episode.published_date.wday]})")