Skip to content

Business intelligence made simple

Do not cache the statement on edit page

Fred Liang3ceace18a6e0
diff --git a/app/views/blazer/queries/_form.html.erb b/app/views/blazer/queries/_form.html.erb
index b658770a..052be644 100644
--- a/app/views/blazer/queries/_form.html.erb
+++ b/app/views/blazer/queries/_form.html.erb
@@ -98,7 +98,9 @@
_this.running = false
_this.showResults(data)
- DraftStore.saveDraft(_this.getSQL())
+ <% if @query.new_record? %>
+ DraftStore.saveDraft(_this.getSQL())
+ <% end %>
errorLine = _this.getErrorLine()
if (errorLine) {
@@ -167,8 +169,10 @@
this.editor = editor
- var draftSQL = DraftStore.restoreDraft()
- if (draftSQL) { editor.setValue(draftSQL) }
+ <% if @query.new_record? %>
+ var draftSQL = DraftStore.restoreDraft()
+ if (draftSQL) { editor.setValue(draftSQL) }
+ <% end %>
editor.getSession().on("change", function () {
$("#query_statement").val(editor.getValue())