Class: Proclaim::SubscriptionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Proclaim::SubscriptionsController
- Defined in:
- app/controllers/proclaim/subscriptions_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #new ⇒ Object
- #subscribed ⇒ Object
- #unsubscribe ⇒ Object
- #unsubscribed ⇒ Object
Instance Method Details
#create ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/proclaim/subscriptions_controller.rb', line 23 def create @subscription = Subscription.new(subscription_params) @subscription if antispam_params[:answer] == antispam_params[:solution] respond_to do |format| if @subscription.save format.html { redirect_to subscribed_path } else format.html { render :new } end end else @subscription.errors.add(:base, "Antispam question wasn't answered correctly") respond_to do |format| format.html { render :new } end end end |
#destroy ⇒ Object
44 45 46 47 48 49 |
# File 'app/controllers/proclaim/subscriptions_controller.rb', line 44 def destroy @subscription @subscription.destroy redirect_to unsubscribed_path, notice: "Successfully unsubscribed." end |
#new ⇒ Object
8 9 10 11 |
# File 'app/controllers/proclaim/subscriptions_controller.rb', line 8 def new @subscription = Subscription.new @subscription end |
#subscribed ⇒ Object
13 14 |
# File 'app/controllers/proclaim/subscriptions_controller.rb', line 13 def subscribed end |
#unsubscribe ⇒ Object
16 17 18 |
# File 'app/controllers/proclaim/subscriptions_controller.rb', line 16 def unsubscribe @subscription end |
#unsubscribed ⇒ Object
20 21 |
# File 'app/controllers/proclaim/subscriptions_controller.rb', line 20 def unsubscribed end |