[英]How to write complex code inside the XLS file on ruby on rails
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
請求超時錯誤-看起來是由於數據庫運行緩慢所致。 嘗試在本地運行應用程序並連接到遠程數據庫-我想您也會收到超時。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.