From 6f394cc0c763b1f755124fe9290dc35cd728162e Mon Sep 17 00:00:00 2001
From: kenchasonakai
Date: Tue, 1 Oct 2024 20:21:34 +0900
Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E3=83=90=E3=82=B0=E3=82=92=E4=BF=AE?=
=?UTF-8?q?=E6=AD=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/posts_controller.rb | 6 +++---
app/views/posts/show.html.erb | 2 +-
app/views/shared/_footer.html.erb | 2 +-
app/views/shared/_header.html.erb | 2 +-
app/views/static_pages/top.html.erb | 4 ++--
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb
index cb955dd..ceaf141 100644
--- a/app/controllers/posts_controller.rb
+++ b/app/controllers/posts_controller.rb
@@ -2,7 +2,7 @@ class PostsController < ApplicationController
skip_before_action :authenticate_user!, only: %i[index show]
def index
if params[:tag].present? && params[:tag].is_a?(String)
- @posts = Post.tagged_with(params[:tag].strip).order(created_at: :desc)
+ @posts = Post.tagged_with(params[:tag].strip).include(:tag).order(created_at: :desc)
else
@posts = Post.all.order(created_at: :desc)
end
@@ -11,7 +11,7 @@ def index
def show
respond_to do |format|
format.html do
- @post = current_user.posts.find(params[:id])
+ @post = Post.find(params[:id])
end
format.json do
post = Post.find(params[:id])
@@ -59,6 +59,6 @@ def destroy
private
def post_params
- params.require(:post).permit(:title, :tag_list)
+ params.require(:post).permit(:title, :tag_list, :content)
end
end
diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb
index 3a16de5..9a7754f 100644
--- a/app/views/posts/show.html.erb
+++ b/app/views/posts/show.html.erb
@@ -32,7 +32,7 @@
<% end %>
- <%= link_to post_path(@post), method: :delete, data: { confirm: "本当に削除しますか?" } do %>
+ <%= link_to post_path(@post), data: { turbo_method: :delete, turbo_confirm: "本当に削除しますか?" } do %>
<%= image_tag "delete.svg", class: "w-4 h-4 me-2" %>
削除する
<% end %>
diff --git a/app/views/shared/_footer.html.erb b/app/views/shared/_footer.html.erb
index 3e4c392..b87162c 100644
--- a/app/views/shared/_footer.html.erb
+++ b/app/views/shared/_footer.html.erb
@@ -32,7 +32,7 @@
d="M19.615 3.184c-3.604-.246-11.631-.245-15.23 0-3.897.266-4.356 2.62-4.385 8.816.029 6.185.484 8.549 4.385 8.816 3.6.245 11.626.246 15.23 0 3.897-.266 4.356-2.62 4.385-8.816-.029-6.185-.484-8.549-4.385-8.816zm-10.615 12.816v-8l8 3.993-8 4.007z">
<% end %>
- <%= link_to "/social_portfolios/hisaju", target: "_blank" do %>
+ <%= link_to "https://school.runteq.jp/social_portfolios/hisaju", target: "_blank" do %>
<%= image_tag "beer_glass.svg", class: "w-6 h-6" %>
<% end %>
diff --git a/app/views/shared/_header.html.erb b/app/views/shared/_header.html.erb
index c58be41..d8dfd27 100644
--- a/app/views/shared/_header.html.erb
+++ b/app/views/shared/_header.html.erb
@@ -26,7 +26,7 @@
<% if user_signed_in? %>
<%= link_to "投稿する", new_post_path %>
<%= link_to "投稿一覧", posts_path %>
- <%= link_to "ログアウト", destroy_user_session_path %>
+ <%= link_to "ログアウト", destroy_user_session_path, data: { turbo_method: :delete } %>
<% else %>
<%= link_to "ログイン", new_user_session_path %>
<%= link_to "新規登録", new_user_registration_path %>
diff --git a/app/views/static_pages/top.html.erb b/app/views/static_pages/top.html.erb
index c8623f9..d301a5f 100644
--- a/app/views/static_pages/top.html.erb
+++ b/app/views/static_pages/top.html.erb
@@ -6,9 +6,9 @@
バグばかりのアプリケーションへようこそ。このアプリはいたるところにバグが潜んでいます。このアプリを使ってバグを見つけて報告してください。
<% if user_signed_in? %>
- <%= link_to "はじめよう", "posts_path", class: "btn btn-primary" %>
+ <%= link_to "はじめよう", posts_path, class: "btn btn-primary" %>
<% else %>
- <%= link_to "はじめよう", "new_user_registration_path", class: "btn btn-primary" %>
+ <%= link_to "はじめよう", new_user_registration_path, class: "btn btn-primary" %>
<% end %>
From 5ab829b07522bb22472747af98ca4f0c944fd234 Mon Sep 17 00:00:00 2001
From: kenchasonakai
Date: Tue, 1 Oct 2024 20:26:32 +0900
Subject: [PATCH 2/2] =?UTF-8?q?rm:=20include=E3=82=92=E5=89=8A=E9=99=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/posts_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb
index ceaf141..31e7ae2 100644
--- a/app/controllers/posts_controller.rb
+++ b/app/controllers/posts_controller.rb
@@ -2,7 +2,7 @@ class PostsController < ApplicationController
skip_before_action :authenticate_user!, only: %i[index show]
def index
if params[:tag].present? && params[:tag].is_a?(String)
- @posts = Post.tagged_with(params[:tag].strip).include(:tag).order(created_at: :desc)
+ @posts = Post.tagged_with(params[:tag].strip).order(created_at: :desc)
else
@posts = Post.all.order(created_at: :desc)
end