Called create_lead in model, FactoryBot errors

This commit is contained in:
Ziyi 2021-03-19 11:13:39 -07:00 committed by CactusPuppy
parent 09becbc3e0
commit f98f35ec8d
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
3 changed files with 66 additions and 1 deletions

View file

@ -80,6 +80,8 @@ class User < ApplicationRecord
after_save :touch_events
after_commit :mailbluster_create_lead, on: :create
# add scope
scope :comment_notifiable, ->(conference) {joins(:roles).where('roles.name IN (?)', [:organizer, :cfp]).where('roles.resource_type = ? AND roles.resource_id = ?', 'Conference', conference.id)}
@ -362,6 +364,9 @@ class User < ApplicationRecord
end
# TODO email_hash function for mailbluster
# def email_hash
# Digest::MD5.hexdigest user.email
# end
private
@ -369,6 +374,10 @@ class User < ApplicationRecord
self.is_admin = true if User.empty?
end
def mailbluster_create_lead
ApplicationController.helpers.create_lead(self)
end
def touch_events
event_users.each(&:touch)
end