Class: Proclaim::SubscriptionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Proclaim::SubscriptionsController
- Defined in:
- app/controllers/proclaim/subscriptions_controller.rb
Instance Method Summary collapse
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 43 44 45 46 47 48 |
# 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 subscription_path(@subscription.token), notice: "Thanks for subscribing! You should "\ "receive a confirmation email soon." } 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
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/controllers/proclaim/subscriptions_controller.rb', line 50 def destroy @subscription @subscription.destroy respond_to do |format| format.html { if redirect_to subscriptions_path, notice: "Subscription was successfully destroyed." else redirect_to posts_path, notice: "Successfully unsubscribed. Sorry to "\ "see you go!" end } end end |
#index ⇒ Object
9 10 11 12 |
# File 'app/controllers/proclaim/subscriptions_controller.rb', line 9 def index @subscriptions = policy_scope(Subscription).order(:comment_id, :name) Subscription end |
#new ⇒ Object
14 15 16 17 |
# File 'app/controllers/proclaim/subscriptions_controller.rb', line 14 def new @subscription = Subscription.new @subscription end |
#show ⇒ Object
19 20 21 |
# File 'app/controllers/proclaim/subscriptions_controller.rb', line 19 def show @subscription end |