giboon mailchimp 404错误

时间:2015-08-04 05:07:10

标签: ruby-on-rails mailchimp

我正在使用Amro的ROR Gem Gibonn与mailchimp整合。 我已经按照https://github.com/amro/gibbon的方法进行了操作。当我尝试添加新订户时,我收到404错误“ResourceNotFound”。事情是我不确定找不到什么“资源”。

这是我的_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!") %>

&lt;%end%&gt;`

这是我的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

1 个答案:

答案 0 :(得分:0)

:中的list_id前面有gb.lists(:list_id).members.create个错误。

如果您将其更改为gb.lists(list_id).members.create,则应该有效。