How can I create an alert after someone subscribes to an email list in Rails 4 with the Gibbon gem?
<%= 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 %>
This is the controller action:
def subscribe
@list_id = "43dcea1d12"
gb = Gibbon::API.new
gb.lists.subscribe({
:id => @list_id,
:email => {:email => params[:email][:address]}
})
end
I have tried adding the following before or after the gb.lists.subscribe call without luck
flash[:alert] = "Subscribed!"