From 86c467b2f1804131e7b1285356e0066151bfe703 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Wed, 4 Nov 2015 00:14:14 -0500 Subject: [PATCH] current_user can be nil --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d275eaea..4278637f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -61,6 +61,6 @@ private unsafe_uri = request.env["REQUEST_URI"] valid_url = /^https?:\/\/([\w\.-]+)(:\d{1,5})?\/?$/ safe_uri = (unsafe_uri.match(valid_url)) ? unsafe_uri : "http://metamaps.cc/" - @invite_link = "#{safe_uri}join?code=#{current_user.code}" + @invite_link = "#{safe_uri}join" + (current_user ? "?code=#{current_user.code}" : "") end end