From 1d7e7fc65465f07e7ddd0a81747a5fcfcec07d50 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 22 Nov 2017 16:27:47 +0100 Subject: [PATCH] [Fix #432] Stop raising a useless exception in get_position MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When an accompagnateur, in the old UI, wants to see a map, this call crashes because he’s not the owner or invitee on the dossier he’s looking at, therefore current_user_dossier raises an exception --- app/controllers/users/carte_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/users/carte_controller.rb b/app/controllers/users/carte_controller.rb index 09c8dd0ec..a281cab58 100644 --- a/app/controllers/users/carte_controller.rb +++ b/app/controllers/users/carte_controller.rb @@ -31,7 +31,12 @@ class Users::CarteController < UsersController end def get_position - etablissement = current_user_dossier.etablissement + begin + etablissement = current_user_dossier.etablissement + rescue ActiveRecord::RecordNotFound + etablissement = nil + end + point = Carto::Geocodeur.convert_adresse_to_point(etablissement.geo_adresse) unless etablissement.nil? lon = '2.428462'