在有人使用 Gibbon gem 订阅 Rails 4 中的电子邮件列表后,如何创建警报?
<%= form_tag('/static_pages/subscribe', method: "post", :class => 'form-inline', id: "subscribe-form", remote: "true",) do %>
<div class='input-group'>
<%= email_field(:email, :address, {id: "email", placeholder: "email address", class: 'btn btn-lg'}) %>
<%= submit_tag(:submit, class: "btn btn-info btn-lg", id: "email-click", 'data-disable-with' => "Please wait...") %>
</div>
<% end %>
这是控制器动作:
def subscribe
@list_id = "43dcea1d12"
gb = Gibbon::API.new
gb.lists.subscribe({
:id => @list_id,
:email => {:email => params[:email][:address]}
})
end
我尝试在 gb.lists.subscribe 调用之前或之后添加以下内容,但没有成功
flash[:alert] = "Subscribed!"