Module: CatarseMailchimp::ActiveRecord

Defined in:
lib/catarse_mailchimp/active_record.rb

Instance Method Summary collapse

Instance Method Details

#sync_with_mailchimpObject

USAGE

# Simple example
class User < ActiveRecord::Base
  sync_with_mailchimp
end


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/catarse_mailchimp/active_record.rb', line 9

def sync_with_mailchimp
  self.class_eval "    after_save do\n      if newsletter\n        CatarseMailchimp::API.subscribe(self)\n      else\n        CatarseMailchimp::API.unsubscribe(self)\n      end\n    end\n  RUBY\nend\n"