开发者

A copy of ApplicationHelper has been removed from the module tree but is still active?

I'm using rails 2.3.4 and ruby 1.8.7. In my application when i try to purchase an item via mobile Api(it's a metal request), purchase is successful , now when i go to web interface and make any changes in the entities like purchase limit or price of the item and then try to purchase through mobile api again, it throws an error

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'.

I looked around in the web as no of people have faced the same issue but unable to find the fix for the same.Now when the server is restarted and i tried to purchase , it is successful.I can't figure out the reason but still like to put my ideas, can it be fixed if after every action we connect to the database as error is thrown from the line where database query is made :

def purchases_left 
  accepted = AcceptedOffer.find_all_by_offer_id_and_user_id(offer.id, current_user.id)
end

i have printed the value of开发者_如何学编程 offer and is coming correct.I cannot think of what more piece of code to put up.Any queries are welcomed.


Error occurs in development mode as cache is set to false, so after setting the cache to true atleast in dev mode, error will not occur but query caching will take place so you need to work upon it.Also in mine it was a metal request which was not loading the classes after the next action is called . In case of production, query caching takes place while error doesn't appear in this mode, but results are not as expected as changes in database were not reflected. So in both the cases the solution which worked or me is bypass query caching.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜