Gibbon Mailchimp整合根本不起作用

时间:2014-11-24 21:45:17

标签: ruby-on-rails gibbon

查看

<%= form_tag('/posts/subscribe', method: "post", id: "subscribe", remote: "true") do %>
    <div class="large-18 columns text-right mailer">
    <%= email_field(:email, :address, {id: "mailersub", placeholder: "Enter your email"}) %>
    </div>
    <div class="large-6 columns text-right mailer">
        <%= submit_tag("Submit", id: "mailersubmit") %>
    </div>
<% end %>

帖子控制器

  def subscribe

    @list_id = "01d4732307"
    gb = Gibbon::API.new

    gb.lists.subscribe({
      :id => @list_id,
      :email => {:email => params[:email][:address]}
      })

  end

路线

  resources :posts do
    member do
       post :subscribe
    end
  end

初​​始化程序

 Gibbon::API.api_key = "5dbfa9b02dd8a28aa43937d19234da5e-us9"
  Gibbon::API.timeout = 15
  Gibbon::API.throws_exceptions = false

当我点击提交时,它什么也没做,我不确定我做错了什么。以下是我试图遵循的指南:http://cheshireoctopus.github.io/blog/2014/01/23/mailchimp-plus-gibbon-plus-rails-create-a-basic-sign-up-form/

1 个答案:

答案 0 :(得分:0)

这个问题有点陈旧,但由于没有答案,有一天它可能对某人有所帮助。

如果您遇到这种情况,可能是因为添加的用户处于待处理状态,他们必须选择加入才能完全订阅。尝试将参数double_optin添加到false,如the API documentation中所述。

gb.lists.subscribe({
      :id => @list_id,
      :email => {:email => params[:email][:address]},
      :double_optin => false
      })