#19 Wiki 新規作成完成

This commit is contained in:
2025-06-11 00:04:21 +09:00
parent 5b8a560024
commit 56f9ba699c
7 changed files with 109 additions and 180 deletions
+3 -3
View File
@@ -13,17 +13,17 @@ class WikiPage < ApplicationRecord
page&.raw_data
end
def body= content, user:
def set_body content, user:
page = wiki.page("#{ id }.md")
commit_info = { message: "Update #{ title }",
name: user.id,
name: user.id.to_s,
email: 'dummy@example.com' }
if page
page.update(content, commit: commit_info)
else
wiki.write_page("#{ id }.md", :markdown, content, commit_info)
wiki.write_page(id.to_s, :markdown, content, commit_info)
end
end