This repository has been archived by the owner on Jul 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Brian /bdougie/ Douglas
committed
Nov 30, 2014
1 parent
b186cc6
commit e3443ea
Showing
5 changed files
with
38 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
class SubscribeController < ApplicationController | ||
|
||
def index | ||
end | ||
|
||
def create | ||
@list_id = ENV['MAILCHIMP_LIST_ID'] | ||
@subscrition = Gibbon::API.new | ||
@subscrition.lists.subscribe({ | ||
id: @list_id, | ||
email: { email: subscribe_params[:email] } | ||
}), :merge_vars => {:FNAME => 'Early Adopter'}, :double_optin => false}) | ||
|
||
# TODO create a modal to enter their name. | ||
# | ||
redirect_to_back | ||
rescue Gibbon::MailChimpError => e | ||
return redirect_to root_path, :flash => { error: e.message } | ||
end | ||
|
||
private | ||
def subscribe_params | ||
params.require(:subscription_form).permit(:email) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,6 @@ class SubscriptionForm | |
extend ActiveModel::Naming | ||
|
||
attribute :email, String | ||
attribute :name, String | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters