浏览代码

Fix request data too large

Andrew Kane 8 年之前
父节点
当前提交
0c4940969b

+ 1 - 1
app/controllers/blazer/base_controller.rb

@@ -42,7 +42,7 @@ module Blazer
     helper_method :extract_vars
 
     def variable_params
-      params.except(:controller, :action, :id, :host, :query, :dashboard, :query_id, :query_ids, :table_names, :authenticity_token, :utf8, :_method, :commit, :statement, :data_source, :name)
+      params.except(:controller, :action, :id, :host, :query, :dashboard, :query_id, :query_ids, :table_names, :authenticity_token, :utf8, :_method, :commit, :statement, :data_source, :name, :fork_query_id)
     end
     helper_method :variable_params
 

+ 3 - 0
app/controllers/blazer/queries_controller.rb

@@ -17,6 +17,9 @@ module Blazer
         data_source: params[:data_source],
         name: params[:name]
       )
+      if params[:fork_query_id]
+        @query.statement ||= Blazer::Query.find(params[:fork_query_id]).try(:statement)
+      end
     end
 
     def create

+ 1 - 1
app/views/blazer/queries/show.html.erb

@@ -25,7 +25,7 @@
       </div>
       <div class="col-sm-3 text-right">
         <%= link_to "Edit", edit_query_path(@query, variable_params), class: "btn btn-default" %>
-        <%= link_to "Fork", new_query_path(variable_params.merge(statement: @query.statement, data_source: @query.data_source, name: "Fork of #{@query.name}")), class: "btn btn-info" %>
+        <%= link_to "Fork", new_query_path(variable_params.merge(fork_query_id: @query.id, data_source: @query.data_source, name: "Fork of #{@query.name}")), class: "btn btn-info" %>
 
         <% if !@error && @success %>
           <%= button_to "Download", run_queries_path(query_id: @query.id, format: "csv"), params: {statement: @statement}, class: "btn btn-primary" %>