Merge branch 'feature/209' of https://git.miteruzo.com/miteruzo/btrc-hub into feature/209 Merge branch 'main' into feature/209 Merge remote-tracking branch 'origin/main' into feature/209 #209 #209 Co-authored-by: miteruzo <miteruzo@naver.com> Reviewed-on: https://git.miteruzo.com/miteruzo/btrc-hub/pulls/212pull/224/head
| @@ -81,7 +81,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(' ') | ||||
| @@ -122,7 +122,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 | |||||
| @@ -10,7 +10,7 @@ | |||||
| # | # | ||||
| # It's strongly recommended that you check this file into your version control system. | # It's strongly recommended that you check this file into your version control system. | ||||
| ActiveRecord::Schema[8.0].define(version: 2025_12_30_143400) do | |||||
| ActiveRecord::Schema[8.0].define(version: 2026_01_07_034300) do | |||||
| create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| | create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| | ||||
| t.string "name", null: false | t.string "name", null: false | ||||
| t.string "record_type", null: false | t.string "record_type", null: false | ||||
| @@ -84,7 +84,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_12_30_143400) do | |||||
| end | end | ||||
| create_table "posts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| | create_table "posts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| | ||||
| t.string "title", null: false | |||||
| t.string "title" | |||||
| t.string "url", limit: 2000, null: false | t.string "url", limit: 2000, null: false | ||||
| t.string "thumbnail_base", limit: 2000 | t.string "thumbnail_base", limit: 2000 | ||||
| t.bigint "parent_id" | t.bigint "parent_id" | ||||