From 7f4686ad7100e961eba2d194c03c2da8f1b18724 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 26 Dec 2013 22:52:14 +0100 Subject: [PATCH] Improved error handling. --- .../app/controllers/_application_controller_table.js.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee index 161533fa1..4106ad091 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee @@ -134,8 +134,9 @@ class App.ControllerTable extends App.Controller for attribute in attributes if rowWithoutId is attribute.name if attribute.relation && App[ attribute.relation ] - record = App[ attribute.relation ].find( object[rowWithoutId] ) - object[row.name] = record.name + if App[ attribute.relation ].exists( object[rowWithoutId] ) + record = App[ attribute.relation ].find( object[rowWithoutId] ) + object[row.name] = record.name @log 'debug', 'table', 'header', header, 'overview', dataTypesForCols, 'objects', data.objects table = App.view('generic/table')(