blob: 210bbaaa29810b9e129751171dd0a210cfec2a3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
class SignUp < ActiveRecord::Base
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, format: { with: VALID_EMAIL_REGEX },
uniqueness: { case_sensitive: false }
def subscribe
logger.info("subscribing #{self.email} to #{ENV['MAILCHIMP_LIST_ID']}")
gibbon = Gibbon.new
gibbon.list_subscribe({
id: ENV['MAILCHIMP_LIST_ID'],
email_address: self.email,
email_type: "html",
double_optin: false,
update_existing: true,
replace_interests: false,
send_welcome: false
})
end
end
|