Class: Spotlight::InviteUsersService
- Inherits:
-
Object
- Object
- Spotlight::InviteUsersService
- Defined in:
- app/services/spotlight/invite_users_service.rb
Overview
A simple service to invite any users who where created by an invitation but it was never sent. This is done because the associated information between the resource, the role, and the user need to be persisted in order to generate the appropriate content in the invitation email.
Class Method Summary collapse
Class Method Details
.call(resource:) ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/services/spotlight/invite_users_service.rb', line 9 def self.call(resource:) resource.roles.includes(:user).find_each do |role| user = role.user user.deliver_invitation if user.created_by_invite? && user.invitation_sent_at.blank? end end |