ぼざクリタグ広場 https://hub.nizika.monster
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

18 lines
346 B

  1. # frozen_string_literal: true
  2. module MaterialRepr
  3. BASE = { only: [:id, :url, :parent_id, :created_at, :updated_at],
  4. include: { created_by_user: UserRepr::BASE, tag: TagRepr::BASE } }.freeze
  5. module_function
  6. def base(material)
  7. material.as_json(BASE)
  8. end
  9. def many(materials)
  10. materials.map { |m| base(m) }
  11. end
  12. end