Browse files

fix chimpy for frontend

  • Loading branch information...
1 parent e351060 commit 708f650f75211d25cd263c34eea84e2f8e26b21b @sbounmy committed Jan 31, 2014
Showing with 15 additions and 13 deletions.
  1. +15 −13 app/controllers/spree/chimpy/subscribers_controller.rb
View
28 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.