【发布时间】:2011-11-28 14:17:51
【问题描述】:
我正在使用 rails 2.3.4 和 ruby 1.8.7。 在我的应用程序中,当我尝试通过移动 Api 购买商品(这是一个金属请求)时,购买成功,现在当我进入 Web 界面并在实体中进行任何更改(如购买限制或商品价格)然后尝试再次通过手机api购买,报错
A copy of ApplicationHelper has been removed from the module tree but is still active!
[RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/dependencies.rb:414:in `load_missing_constant'
[RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `const_missing_not_from_s3_library'
/home/user/.rvm/gems/ruby-1.8.7-p334/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing'
[RAILS_ROOT]/app/helpers/web_application_helper.rb:414:in `purchases_left'
[RAILS_ROOT]/app/helpers/web_application_helper.rb:83:in `accept_purchase_direct'
[RAILS_ROOT]/lib/api/publisher/v1_purchases_helper.rb:49:in `purchases_handler'
[RAILS_ROOT]/app/metal/v1_purchases_controller.rb:54:in `call'
[RAILS_ROOT]/vendor/rails/railties/lib/rails/rack/metal.rb:44:in `call'
[RAILS_ROOT]/vendor/rails/railties/lib/rails/rack/metal.rb:43:in `each'
[RAILS_ROOT]/vendor/rails/railties/lib/rails/rack/metal.rb:43:in `call'
[RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:122:in `call'.
我在网上四处寻找,因为没有人遇到过同样的问题,但找不到相同的修复程序。现在当服务器重新启动并尝试购买时,它成功了。我不知道原因,但仍然想提出我的想法,如果在每次操作后我们连接到数据库,因为从进行数据库查询的行抛出错误,是否可以修复:
def purchases_left
accepted = AcceptedOffer.find_all_by_offer_id_and_user_id(offer.id, current_user.id)
end
我已经打印了报价的价值,并且是正确的。我想不出还有什么代码可以放。欢迎任何查询。
【问题讨论】:
标签: ruby-on-rails ruby