This commit is contained in:
2025-05-21 01:16:40 +09:00
parent 09ed1c493a
commit 59678cf8b9
7 changed files with 75 additions and 4 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+8
View File
@@ -4,4 +4,12 @@ class Post < ApplicationRecord
has_many :post_tags, dependent: :destroy
has_many :tags, through: :post_tags
has_many :user_post_views, dependent: :destroy
has_one_attached :thumbnail
def as_json options = { }
super(options).merge({ thumbnail: thumbnail.attached? ?
Rails.application.routes.url_helpers.rails_blob_url(
thumbnail, only_path: false) :
nil })
end
end