rails-guide-store/app/controllers/unsubscribes_controller.rb

16 lines
348 B
Ruby
Raw Normal View History

2025-01-24 19:11:47 +00:00
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