I'm not sure why, but emails aren't being passed through to my Mailchimp list. Clicking the submit button doesn't do anything. Any thoughts?
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 %>
models/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
initializers/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'
controllers/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
Solved it with this code here: Mailchimp gem double_optin false not working
but having issues with double opt-in => false