如何只使用 .pluck 抓取前 x 条记录?

How to use only use .pluck to grab the first x amount of records?

.pluck 能否仅用于获取前 5 个值

例如

 CategoryItemKey.where(category_id: @category.id).pluck(:name)

我只想要前 5 个名字。此外,如果只有 3 个名称,它不会抛出错误,它只会抓取 3 个。

无法在文档或 google 搜索中看到它。我将如何做到这一点?

CategoryItemKey.where(category_id: @category.id).pluck(:name)[0...5]