def category_ids
      component
        .categories
        .where(id: category_id)
        .or(component.categories.where(parent_id: category_id))
        .pluck(:id)
    end
def category_ids
      component
        .categories
        .where(id: category_id)
        .or(component.categories.where(parent_id: category_id))
        .pluck(:id)
    end
Private: Creates an array of category ids.
 It contains categories' subcategories ids as well.