I'm trying to subscribe users to a mailchimp, not sure if i'm making an error on the form or the controller , I followed some tutorials online but haven't had no luck.
I'll appreciated any help thank you
Here is my view using a form_tag
<h1>Newsletter subscribe</h1>
<p>Sign up for email updates</p>
<%= form_tag('subscribenow', method: "post", id: "subscribe", remote: "true") do %>
<%= email_field(:email,:address, {id: "email", placeholder: "email address"}) %>
<%= submit_tag("Sign me up!") %>
<% end %>
this is my controller
class EmailapiController < ApplicationController
def index
end
def subscribe
list_id = "my_id"
gb = Gibbon::API.new
gb.lists.subscribe({:id => list_id,
:email => {:email => 'email_address'},
:merge_vars => {:FNAME => 'First Name',
:LNAME => 'Last Name'},
:double_option => false})
end
end
(these are my routes on the routes.rb file)
get 'emailsignup' => 'emailapi#index'
post 'subscribenow'=> 'emailapi#subscribe'
my initializer file
Gibbon::API.api_key = "my_api_key"
Gibbon::API.timeout = 15
Gibbon::API.throws_exceptions = false
This is the error I get on my local server
Started POST "/subscribenow" for 127.0.0.1 at 2014-11-12 07:49:10 -0800
ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations" Processing by EmailapiController#subscribe as JS Parameters: {"utf8"=>"✓", "email"=>{"address"=>"[email protected]"}, "commit"=>"Sign me up!"} Completed 500 Internal Server Error in 353ms
ActionView::MissingTemplate (Missing template emailapi/subscribe, application/subscribe with {:locale=>[:en], :formats=>[:js, "application/ecmascript", "application/x-ecmascript", :html, :text, :js, :css, :ics, :csv, :vcf, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. Searched in: * "/Users/blanco/.rvm/gems/ruby-2.1.4/gems/web-console-2.0.0.beta3/lib/action_dispatch/templates" * "/Users/blanco/Desktop/Rails_projects/dansbuzz/app/views" * "/Users/blanco/.rvm/gems/ruby-2.1.4/gems/web-console-2.0.0.beta3/app/views" ):