Sha256: 9583c390c9682a720067837894e3dced7956a11f7dd9b529e700aa2a5ec4aacd

Contents?: true

Size: 447 Bytes

Versions: 1

Compression:

Stored size: 447 Bytes

Contents

module CatarseMailchimp
  module ActiveRecord
    # USAGE
    #
    #   # Simple example
    #   class User < ActiveRecord::Base
    #     sync_with_mailchimp
    #   end
    def sync_with_mailchimp
      self.class_eval <<-RUBY
        after_save do
          if newsletter
            CatarseMailchimp::API.subscribe(self)
          else
            CatarseMailchimp::API.unsubscribe(self)
          end
        end
      RUBY
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
catarse_mailchimp-0.0.1 lib/catarse_mailchimp/active_record.rb