# 批量创建数千份邀请函

**URL:** <https://meta.discourse.org/t/creating-thousands-of-invitations-in-bulk/305271>\
**Category:** Product Support\
**Tags:** invites\
**Created:** [2024 年4 月 24 日 14:32 UTC](https://meta.discourse.org/t/creating-thousands-of-invitations-in-bulk/305271 "2024-04-24T14:32:31Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

作者： ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
发布日期： [2024 年4 月 24 日 16:56 UTC](https://meta.discourse.org/t/creating-thousands-of-invitations-in-bulk/305271/7 "2024-04-24T16:56:32Z")

</div>

我也猜想没有可以使用的SSO认证。

在这种情况下，@pfaffman 建议的方法是可行的。

类似这样的代码：

```plaintext
user = User.find_by(username: 'system')
16000.times do
  i = Invite.generate(user, skip_email: true, max_redemptions_allowed: 1)
  puts "/invites/#{i.invite_key}"
  # 将 "/invites/#{i.invite_key}" 写入文件
end

```

可以实现。先从1或2次的循环开始，直到你得到预期的结果。

一种懒惰但可行的方法是直接打印所有内容（puts）并记录你的终端会话 😃

---

_[View the full topic](https://meta.discourse.org/t/creating-thousands-of-invitations-in-bulk/305271)._
