This commit is contained in:
2025-12-29 07:02:02 +09:00
parent 2832d0a6ca
commit 23d6303b49
6 changed files with 32 additions and 36 deletions
@@ -72,7 +72,7 @@ class WikiPagesController < ApplicationController
return head :unprocessable_entity if title.blank? || body.blank?
page = WikiPage.new(title:)
page = WikiPage.new(title:, created_user: current_user, updated_user: current_user)
if page.save
message = params[:message].presence
+2
View File
@@ -3,6 +3,8 @@ require 'set'
class WikiPage < ApplicationRecord
has_many :wiki_revisions, dependent: :destroy
belongs_to :created_user, class_name: 'User'
belongs_to :updated_user, class_name: 'User'
has_many :redirected_from_revisions,
class_name: 'WikiRevision',
+1 -1
View File
@@ -7,7 +7,7 @@ class WikiRevision < ApplicationRecord
has_many :wiki_revision_lines, dependent: :delete_all
has_many :wiki_lines, through: :wiki_revision_lines
enum kind: { content: 0, redirect: 1 }
enum :kind, { content: 0, redirect: 1 }
validates :kind, presence: true
validates :lines_count, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
+1 -1
View File
@@ -112,7 +112,7 @@ module Wiki
end
if missing_rows.any?
WikiLine.upsert_all(missing_rows, unique_by: :index_wiki_lines_on_sha256)
WikiLine.upsert_all(missing_rows)
id_by_sha = WikiLine.where(sha256: line_shas).pluck(:sha256, :id).to_h
end