Create confirmation for the given schedule if user accept the invitation from existing user.
# File app/workers/accept_invite_worker.rb, line 4 def perform(invite_id) invite = Invite.find(invite_id) invite.invite_resources.each do |invite_resource| schedule = Schedule.find(invite_resource.resource_id) user = User.find(invite.invitee_id) confirmation = schedule.confirmations.build(user: user, initiator: false) confirmation.accept if confirmation.save EventMailer.delay(queue: :mailer).notify_owner_for_event_acceptance(schedule.id, user.id, 'accepted') if schedule.event? and user.notification_enabled_for?('schedule') end end end