app/controllers/mailkick/subscriptions_controller.rb in mailkick-0.1.0 vs app/controllers/mailkick/subscriptions_controller.rb in mailkick-0.1.1
- old
+ new
@@ -5,16 +5,16 @@
def show
end
def unsubscribe
Mailkick.opt_out(@options)
- redirect_to subscription_path(params[:id])
+ redirect_to subscription_path(url_token)
end
def subscribe
Mailkick.opt_in(@options)
- redirect_to subscription_path(params[:id])
+ redirect_to subscription_path(url_token)
end
protected
def set_email
@@ -39,16 +39,22 @@
Mailkick.opted_out?(@options)
end
helper_method :opted_out?
def subscribe_url
- subscribe_subscription_path(params[:id])
+ subscribe_subscription_path(url_token)
end
helper_method :subscribe_url
def unsubscribe_url
- unsubscribe_subscription_path(params[:id])
+ unsubscribe_subscription_path(url_token)
end
helper_method :unsubscribe_url
+
+ private
+
+ def url_token
+ @url_token ||= CGI::escape(params[:id])
+ end
end
end