class CategoriesController < ApplicationController
  skip_authorization_check

  def index
    @categories ||= CategoryDecorator.decorate_collection(Category.all)
  end
end

class CategoriesController < ApplicationController
  skip_authorization_check

  def index
    categories = Category.includes(:subcategories)
    @categories ||= CategoryDecorator.decorate_collection(categories)
  end
end

Load all subcategories at once
Load all subcategories at once
