Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Can subscribe with custom fields.

  • Loading branch information...
commit f67f63ab17acc042b92e249a9b5137628d7e795d 1 parent 90c6069
Łukasz Anwajler anwajler authored
Showing with 2 additions and 3 deletions.
  1. +2 −3 lib/campaign_monitor_subscriber.rb
5 lib/campaign_monitor_subscriber.rb
View
@@ -3,12 +3,11 @@ module CampaignMonitorSubscriber
CM_CONFIG = YAML::load_file(File.join("config/campaign_monitor_subscriber_config.yml"))
::CAMPAIGN_MONITOR_API_KEY = CM_CONFIG['api_key']
- def subscribe_me_using(email_field)
+ def subscribe_me_using(email_field, custom_fields={})
return if CM_CONFIG[::Rails.env] == false
-
after_create do |record|
begin
- s = Campaigning::Subscriber.new(record.send(email_field))
+ s = Campaigning::Subscriber.new(record.send(email_field), custom_fields.map{|k,v| {k => record.send(v)}})
s.add!(CM_CONFIG['list_id'])
rescue RuntimeError
end
Please sign in to comment.
Something went wrong with that request. Please try again.