From 0be89ff645e6afd41815d864011cc569d3e315ab Mon Sep 17 00:00:00 2001
From: Tom Robinson <tlrobinson@gmail.com>
Date: Tue, 7 Jul 2015 17:46:31 -0700
Subject: [PATCH] Load db metadata when creating a new card regardless of
 whether the db was explicitly passed in

---
 resources/frontend_client/app/card/card.controllers.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/resources/frontend_client/app/card/card.controllers.js b/resources/frontend_client/app/card/card.controllers.js
index b65f1fc0664..840544f6e37 100644
--- a/resources/frontend_client/app/card/card.controllers.js
+++ b/resources/frontend_client/app/card/card.controllers.js
@@ -608,13 +608,16 @@ CardControllers.controller('CardDetail', [
                         if (databases[i].id === databaseId) {
                             card.dataset_query.database = databaseId;
 
-                            // load metadata
-                            editorModel.loadDatabaseInfoFn(card.dataset_query.database);
                         }
                     }
+                }
+
+                if (card.dataset_query.database != null) {
+                    // load metadata
+                    editorModel.loadDatabaseInfoFn(card.dataset_query.database);
 
                     // if we initialized our database safely and we have a table, lets handle that now
-                    if (card.dataset_query.database !== null && $routeParams.table !== undefined) {
+                    if ($routeParams.table != null) {
                         // TODO: do we need a security check here?  seems that if they have access to the db just use the table
                         card.dataset_query.query.source_table = parseInt($routeParams.table);
 
-- 
GitLab