class GroupsController < ApplicationController def index roots = Group.where(parent_id: nil) render jsonapi: roots, include: [children: [children: [:children]]] end end