I am using the ROR Gem Gibonn by Amro for integration with mailchimp. I have followed the how-to at http://ift.tt/1mOZGRi. When I attempt to add a new subscriber I receive a 404 error "ResourceNotFound". Thing is I am not sure what "Resource" is not found.
Here is my _form.html.erb
<%= form_tag('/emailapi/subscribe', method: "post", id: "subscribe") do -%>
<%= text_field(:FNAME, :fname, { placeholder: "First Name"}) %>
<%= text_field(:LNAME, :lname, { placeholder: "Last Name"}) %>
<%= email_field(:email, :email_address, { placeholder: "Email Address"}) %>
<%= submit_tag("Sign me up!") %>
<% end %>`
Here is my emailapi_controller.rb
class EmailapiController < ApplicationController
def index
end
def subscribe
@list_id = "3ea2e9a0c8"
gb = Gibbon::Request.new
gb.lists(:list_id).members.create(body: {
email_address: "email_address",
status: "subscribed",
merge_fields: {
FNAME: "fname",
LNAME: "lname"
}
})
flash[:success] = "Thank you for pay-it-forward.
You are now added to our email list."
redirect_to '/'
end
end
Aucun commentaire:
Enregistrer un commentaire