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发布于 2015-01-21 19:12:37
请求超时错误--看起来像是因为你的数据库太慢了。尝试在本地运行你的应用程序并连接到远程数据库-我认为,你也会收到超时。
https://stackoverflow.com/questions/28065408
复制相似问题