0

我有一个应用程序,管理员在其中使用 devise_invitable 邀请新用户。这工作正常,但我想把事情分开。首先我想创建用户,然后我希望能够邀请他们。如何拆分这些操作?

4

1 回答 1

1

您可以在使用skip_invitation时使用该选项invite!跳过发送实际邀请。

User.invite!(:email => "new_user@example.com", :name => "John Doe", :skip_invitation => true)
# the record will be created, but the invitation email will not be sent

然后,您可以通过以下方式发送邀请:

user = User.find(42)
user.deliver_invitation

https://github.com/scambra/devise_invitable

于 2015-05-22T14:00:38.507 回答