feat: Wiki の管理方法変更(#188) (#195)

Merge branch 'feature/188' of https://git.miteruzo.com/miteruzo/btrc-hub into feature/188

#188

Merge branch 'main' into feature/188

#188

#188

#188

#188

Co-authored-by: miteruzo <miteruzo@naver.com>
Reviewed-on: #195
このコミットはPull リクエスト #195 でマージされました.
このコミットが含まれているのは:
2026-01-04 18:52:17 +09:00
コミット 611455ec55
15個のファイルの変更533行の追加169行の削除
+15
ファイルの表示
@@ -0,0 +1,15 @@
class WikiLine < ApplicationRecord
has_many :wiki_revision_lines, dependent: :restrict_with_exception
validates :sha256, presence: true, uniqueness: true, length: { is: 64 }
validates :body, presence: true
def self.upsert_by_body! body
sha = Digest::SHA256.hexdigest(body)
now = Time.current
upsert({ sha256: sha, body:, created_at: now, updated_at: now })
find_by!(sha256: sha)
end
end