Skip to content

Commit

Permalink
fix chimpy for frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
sbounmy committed Jan 31, 2014
1 parent e351060 commit 708f650
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions app/controllers/spree/chimpy/subscribers_controller.rb
@@ -1,16 +1,18 @@
class Spree::Chimpy::SubscribersController < ApplicationController
respond_to :html
module Spree
class Chimpy::SubscribersController < StoreController
respond_to :html

def create
@subscriber = Spree::Chimpy::Subscriber.where(email: params[:chimpy_subscriber][:email]).first_or_initialize
@subscriber.update_attributes(params[:chimpy_subscriber])
if @subscriber.save
Spree::Chimpy::Subscription.new(@subscriber).subscribe
flash[:notice] = I18n.t("spree.chimpy.subscriber.success")
else
flash[:error] = I18n.t("spree.chimpy.subscriber.failure")
end
def create
@subscriber = Chimpy::Subscriber.where(email: params[:chimpy_subscriber][:email]).first_or_initialize
@subscriber.update_attributes(params[:chimpy_subscriber])
if @subscriber.save
Chimpy::Subscription.new(@subscriber).subscribe
flash[:notice] = I18n.t("spree.chimpy.subscriber.success")
else
flash[:error] = I18n.t("spree.chimpy.subscriber.failure")
end

respond_with @subscriber, location: request.referer
respond_with @subscriber, location: request.referer
end
end
end
end

0 comments on commit 708f650

Please sign in to comment.