【发布时间】:2015-01-21 10:54:09
【问题描述】:
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
【问题讨论】:
标签: ruby-on-rails ruby heroku ruby-on-rails-3.2 heroku-postgres