我不确定原因,但是电子邮件没有传递到我的Mailchimp列表。单击“提交”按钮不会执行任何操作。有什么想法吗?
的Gemfile:
gem 'gibbon', '~> 1.0.0'
index.html.erb:
<%= form_tag('/welcome/subscribe', method: "post", id: "subscribe", remote: "true") do -%>
<%= email_field(:email, :address, {id: "email", placeholder: "email address", :class=>"email form-control"}) %>
<%= submit_tag("Sign me up!", :class=>"btn btn-palette") %>
<% end %>
模型/ welcome.rb:
def subscribe
@list_id = "my list id is in here"
gb = Gibbon::API.new
gb.lists.subscribe({
double_opt_in: false,
:id => @list_id,
:email => {:email => params[:email][:address]}
})
end
初始化/ gibbon.rb:
Gibbon::API.api_key = "my api key is in here"
Gibbon::API.timeout = 15
Gibbon::API.throws_exceptions = false
routes.rb中:
post 'welcome/subscribe' => 'welcome#subscribe'
root 'welcome#index'
控制器/ welcome_controller.rb:
class WelcomeController < ApplicationController
def index
end
def subscribe
@list_id = "my list id is in here"
gb = Gibbon::API.new
gb.lists.subscribe({
double_opt_in: false,
:id => @list_id,
:email => {:email => params[:email][:address]}
})
end
end