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:
@@ -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
|
||||
Reference in New Issue
Block a user