Representations 追加(#241) (#267)

#241

Co-authored-by: miteruzo <miteruzo@naver.com>
Reviewed-on: #267
This commit was merged in pull request #267.
This commit is contained in:
2026-02-22 01:50:56 +09:00
parent a01c63d972
commit 82302cd3d1
7 changed files with 66 additions and 32 deletions
+16
View File
@@ -0,0 +1,16 @@
# frozen_string_literal: true
module PostRepr
BASE = { include: { tags: TagRepr::BASE } }.freeze
module_function
def base post
post.as_json(BASE)
end
def many posts
posts.map { |p| base(p) }
end
end