Merge remote-tracking branch 'origin/main' into feature/215

This commit is contained in:
2026-01-12 14:40:11 +09:00
2 changed files with 30 additions and 2 deletions
+2 -2
View File
@@ -80,7 +80,7 @@ class PostsController < ApplicationController
# TODO: URL が正規のものがチェック,不正ならエラー # TODO: URL が正規のものがチェック,不正ならエラー
# TODO: URL は必須にする(タイトルは省略可). # TODO: URL は必須にする(タイトルは省略可).
# TODO: サイトに応じて thumbnail_base 設定 # TODO: サイトに応じて thumbnail_base 設定
title = params[:title] title = params[:title].presence
url = params[:url] url = params[:url]
thumbnail = params[:thumbnail] thumbnail = params[:thumbnail]
tag_names = params[:tags].to_s.split(' ') tag_names = params[:tags].to_s.split(' ')
@@ -121,7 +121,7 @@ class PostsController < ApplicationController
return head :unauthorized unless current_user return head :unauthorized unless current_user
return head :forbidden unless current_user.member? return head :forbidden unless current_user.member?
title = params[:title] title = params[:title].presence
tag_names = params[:tags].to_s.split(' ') tag_names = params[:tags].to_s.split(' ')
original_created_from = params[:original_created_from] original_created_from = params[:original_created_from]
original_created_before = params[:original_created_before] original_created_before = params[:original_created_before]
@@ -0,0 +1,28 @@
class MakeTitleNullableInPosts < ActiveRecord::Migration[7.0]
def up
change_column_null :posts, :title, true
execute <<~SQL
UPDATE
posts
SET
title = NULL
WHERE
title = ''
SQL
end
def down
execute <<~SQL
UPDATE
posts
SET
title = ''
WHERE
title IS NULL
SQL
change_column_null :posts, :title, false
end
end