This commit is contained in:
2026-03-29 21:27:59 +09:00
parent 2adff3966a
commit c28326b941
10 changed files with 274 additions and 30 deletions
@@ -0,0 +1,17 @@
# frozen_string_literal: true
module MaterialRepr
BASE = { only: [:id, :url, :parent_id, :created_at, :updated_at],
include: { created_by_user: UserRepr::BASE, tag: TagRepr::BASE } }.freeze
module_function
def base(material)
material.as_json(BASE)
end
def many(materials)
materials.map { |m| base(m) }
end
end