Acts as Mailchimp plugin

Plugin details

Rails plugin to interact with the Mail Chimp API

Websitehttp://www.terra-firma-design.com/ Repositorygit://github.com/bgetting/acts_as_mailchimp.git Author Brian Getting Tags mail, chimp LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install git://github.com/bgetting/acts_as_mailchimp.git

Examples

The following controller examples illustrate how to use acts_as_mailchimp:

To add a user to a mailing list called “weekly_newsletter”:

    @user.add_to_mailchimp("weekly_newsletter", false)


To remove a user from a mailing list called “weekly_newsletter”:

    @user.remove_from_mailchimp("weekly_newsletter")


To update information about a user Rails 2.1 or below:

    previous = params[:user][:email]
        if @user.update_attributes(params[:user])
          @user.update_mailchimp("weekly_newsletter", previous) if @user.email != previous
        end


To update information about a user Rails 2.1 or above:

        if @user.update_attributes(params[:user])
          @user.update_mailchimp("weekly_newsletter", @user.email_was) if @user.email_changed?
        end



Keep in mind that you these update examples do not make calls to the MailChimp API unless the user changes their email address. If you are integrating first_name and last_name fields as well, you will need to adjust your controller code to update MailChimp when they change either of these values as well.

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, about 1 year ago