Scott Ribe wrote in post #1176728:
> On Jul 21, 2015, at 10:13 AM, Travis Mr. <[email protected]> wrote:
>>
>> I guess what I'm trying to figure out is.... without any tables or
>> models can I take in a users email address and sent it to my mailchimp
>> account for future email marketing for my info.
>
> Yes, you can do that, no problem.
>
> You probably need to back up and provide us more info about what you're
> doing and the exact error message.
>
When I hit submit with my valid email address I get this error response
in my terminal
Started POST "/emailapi/subscribe" for ::1 at 2015-07-21 19:10:28 -0500
Processing by EmailapisController#subscribe as JS
Parameters: {"utf8"=>"✓",
"email"=>{"address"=>"[email protected]"}, "commit"=>"Sign me
up for the abs!"}
Completed 500 Internal Server Error in 2490ms (ActiveRecord: 0.0ms)
Gibbon::MailChimpError (An email address must contain a single @):
app/controllers/emailapis_controller.rb:8:in `subscribe'
-------CONTROLLER--------
class EmailapisController < ApplicationController
def index
end
def subscribe
gb = Gibbon::API.new(ENV['mailchimp_key'])
gb.lists.subscribe({:id => ENV['mailchimp_id'],
:email => {:email =>'address'}
})
end
end
-------VIEW--------
<div class="landing-box">
<div class="call-action">
<h1>Free weekly Ab Workouts!</h1>
<h4>This isnt your typcal Richard Simmons routine.</h4>
<%= form_tag('/emailapi/subscribe', method: "post", id: "subscribe",
remote: "true") do %>
<%= email_field(:email, :address, {id: "email", placeholder: "email
address"}) %>
<%= submit_tag("Sign me up for the abs!", :class => "btn
btn-success") %>
<% end %>
</div>
<div class="col-md-8 col-md-offset-2">
<div class="final-word">
<p>Stop <i>GUESSING</i> what to do by getting weekly guides on
affective routines! Just type in your email and recieve a weekly ab
routine totally free!</p>
</div>
</div>
</div>
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/2200e3073d5b19c3a6339fd3ee2c9385%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.