rails-guide-store/app/controllers/unsubscribes_controller.rb
2025-01-24 14:11:47 -05:00

15 lines
348 B
Ruby

class UnsubscribesController < ApplicationController
allow_unauthenticated_access
before_action :set_subscriber
def show
@subscriber.destroy
redirect_to root_path, notice: "Unsubscribed successfully."
end
private
def set_subscriber
@subscriber = Subscriber.find_by_token_for(:unsubscribe, params[:token])
end
end