From 4dbff85443c845c9a8a18a0c32d0bda824ebc93d Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Wed, 16 Dec 2015 22:36:12 +0800 Subject: [PATCH] default value if no request.env in application controller passes the rspec test woot. Only 80 more tests to implement --- app/controllers/application_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6a79915c..89b6fa09 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -58,9 +58,9 @@ private end def get_invite_link - unsafe_uri = request.env["REQUEST_URI"] + unsafe_uri = request.env["REQUEST_URI"] || 'http://metamaps.cc' valid_url = /^https?:\/\/([\w\.-]+)(:\d{1,5})?\/?$/ - safe_uri = (unsafe_uri.match(valid_url)) ? unsafe_uri : "http://metamaps.cc/" + safe_uri = (unsafe_uri.match(valid_url)) ? unsafe_uri : 'http://metamaps.cc/' @invite_link = "#{safe_uri}join" + (current_user ? "?code=#{current_user.code}" : "") end end