首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在ruby on rails上的XLS文件中编写复杂的代码

如何在ruby on rails上的XLS文件中编写复杂的代码
EN

Stack Overflow用户
提问于 2015-01-21 18:54:09
回答 1查看 44关注 0票数 0

index.xls.erb

代码语言:javascript
复制
<% @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是我的云,在那里它给出了如下错误

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

发布于 2015-01-21 19:12:37

请求超时错误--看起来像是因为你的数据库太慢了。尝试在本地运行你的应用程序并连接到远程数据库-我认为,你也会收到超时。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28065408

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档