0

紅寶石編寫複雜的代碼XLS文件中index.xls.erb如何在軌道上

<% @gd = GoodsDelivery.find_all_by_store_location_id(stores.id) %> 
<% gd_qty = 0.00 %> 
<% for goods_delivery in @gd %> 
    <% gdl_qty = goods_delivery.goods_delivery_line_items.where(:product_id => prods.id).where(:customer_bill_id => nil).sum(:quantity) %> 
    <% gd_qty = gd_qty + gdl_qty %><% end %> 
    <td><%= gd_qty %></td> 

我有一個代碼,這樣的事情在index.xls.erb文件,因爲有些問題我不能移動它到控制器,但在本地服務器是正常運行的地方作爲Heroku的是我的雲那裏是給錯誤如下

Error Messege : 
Rack::Timeout::RequestTimeoutError: Request ran for longer than 29.989883911185302 seconds.: SELECT SUM("goods_receipt_line_items"."goods_receipt_quantity") AS sum_id FROM "goods_receipt_line_items" WHERE "goods_receipt_line_items"."goods_receipt_id" = 311 AND "goods_receipt_line_items"."product_id" = 133 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:1153:in `async_exec' /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:1153:in `exec_no_cache' /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter 

回答

0

請求超時錯誤 - 看起來像,那是因爲你的速度慢的數據庫。嘗試將本地應用程序運行並連接到遠程數據庫 - 我認爲,您也會收到超時。