RailsApps / rails_apps_composer

A gem with recipes to create Rails application templates for Rails starter apps.
http://railsapps.github.io/rails_apps_composer/
1.42k stars 306 forks source link

rails-devise-roles Gibbon::MailChimpError at /visitors #356

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi there,

This is my first issue here so please stand by.

I have been working on installing the Rails Devis Roles app and running it locally with Linux, having http://localhost:3000/visitors as homepage. So far I´ve had issues (Gibbon errors) with the API-key and the List-ID of my newly created MailChimp account. I added them to my secrets.yml file but that wasn´t sufficient. I had to add those two (api key & list ID) directly to the visitors.rb file. That doens seem right.

Anyhow, after fixing those things I got the following error. Like the ones before, preventing the whole app from running.

Gibbon::MailChimpError at /visitors

getaddrinfo: Name or service not known @title=nil, @detail=nil, @body=nil, @raw_body=nil, @status_code=nil

It seems that MailChimp is somehow unable to create a new member.

def subscribe

    mailchimp = Gibbon::Request.new(api_key: "1cc9...4")         

    list_id = "6...0"                                                                   

    result = mailchimp.lists(list_id).members.create(        ### I get error for this line...!

      body: {

        email_address: self.email,

        status: 'subscribed'

    })

    Rails.logger.info("Subscribed #{self.email} to MailChimp") if result