Ruby on rails 缓存资金';无存储库';错误

Ruby on rails 缓存资金';无存储库';错误,ruby-on-rails,memcached,cache-money,Ruby On Rails,Memcached,Cache Money,我只是在现有应用程序上尝试cache_money gem,但出现以下错误: NoMethodError (You have a nil object when you didn't expect it! The error occurred while evaluating nil.repository) 我想我的memached服务器配置正确。 我使用的是Rails 2.2.2 编辑: 堆栈跟踪: NoMethodError (You have a nil object when you d

我只是在现有应用程序上尝试cache_money gem,但出现以下错误:

NoMethodError (You have a nil object when you didn't expect it!
The error occurred while evaluating nil.repository)
我想我的memached服务器配置正确。 我使用的是Rails 2.2.2

编辑:

堆栈跟踪:

NoMethodError (You have a nil object when you didn't expect it!
The error occurred while evaluating nil.repository):
    (__DELEGATION__):2:in `__send__'
    (__DELEGATION__):2:in `repository'
    /usr/lib/ruby/gems/1.8/gems/nkallen-cache-money-0.2.5/lib/cache_money.rb:50:in `transaction'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:138:in `transaction'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:178:in `with_transaction_returning_status'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:146:in `save_without_trace_ActiveRecord___self_class_name__save'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:158:in `rollback_active_record_state!'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:146:in `save_without_trace_ActiveRecord___self_class_name__save'
    /vendor/plugins/newrelic_rpm/lib/new_relic/agent/method_tracer.rb:138:in `save_without_trace_ActiveRecord_save'
    /vendor/plugins/newrelic_rpm/lib/new_relic/agent/method_tracer.rb:41:in `trace_method_execution_with_scope'
    /vendor/plugins/newrelic_rpm/lib/new_relic/agent/method_tracer.rb:137:in `save_without_trace_ActiveRecord_save'
    /vendor/plugins/newrelic_rpm/lib/new_relic/agent/method_tracer.rb:141:in `save_without_trace_ActiveRecord_all'
    /vendor/plugins/newrelic_rpm/lib/new_relic/agent/method_tracer.rb:141:in `save'
    /vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:237:in `create'
    /vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:405:in `create_record'
    /vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:423:in `add_record_to_target_with_callbacks'
    /vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:405:in `create_record'
    /vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:235:in `create'
    /app/controllers/application.rb:234:in `write_audit_log'
    /app/controllers/application.rb:224:in `write_read_audit_log'
    /vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `send'
    /vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `evaluate_method'
    /vendor/rails/activesupport/lib/active_support/callbacks.rb:166:in `call'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:662:in `run_after_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:619:in `call_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:136:in `perform_action_without_caching'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action_without_newrelic_trace'
    /vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
    /vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action_without_newrelic_trace'
    /vendor/plugins/newrelic_rpm/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:123:in `perform_action'
    /vendor/plugins/newrelic_rpm/lib/new_relic/agent/method_tracer.rb:41:in `trace_method_execution_with_scope'
    /vendor/plugins/newrelic_rpm/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:109:in `perform_action'
    /vendor/plugins/newrelic_rpm/lib/new_relic/agent/method_tracer.rb:18:in `trace_method_execution_no_scope'
    /vendor/plugins/newrelic_rpm/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:103:in `perform_action'
    /vendor/rails/actionpack/lib/action_controller/base.rb:524:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:524:in `process_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process_without_session_management_support'
    /vendor/rails/actionpack/lib/action_controller/session_management.rb:134:in `process'
    /vendor/rails/actionpack/lib/action_controller/base.rb:392:in `process'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:183:in `handle_request'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:110:in `dispatch_unlocked'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:123:in `dispatch_without_newrelic'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:122:in `synchronize'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:122:in `dispatch_without_newrelic'
    /vendor/plugins/newrelic_rpm/lib/new_relic/agent/instrumentation/dispatcher_instrumentation.rb:44:in `dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:132:in `dispatch_cgi'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:39:in `dispatch'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:76:in `process'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in `synchronize'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in `process'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `orig_process_client'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `orig_process_client'
    /vendor/plugins/spawn/lib/patches.rb:59:in `process_client'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
    /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load_without_new_constant_marking'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load'
    /vendor/rails/railties/lib/commands/servers/mongrel.rb:64
    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    /vendor/rails/railties/lib/commands/server.rb:49
    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    script/server:3

如果你使用的是按预期用途使用的现金(很难从你提供的信息中判断),那么这可能是现金中的一个bug。github项目中还报告了其他nil引用错误,其中一些错误自0.2.5版以来已得到解决

您可以在rails项目中以插件的形式查看最新版本的代码:

script/plugin git://github.com/nkallen/cache-money.git
也许他们已经解决了你的问题,因为你的版本。如果没有帮助,您可以从
供应商/plugins/cache money
中删除插件


如果这没有帮助,你可以在作者的问题跟踪器上提交你的问题,看看他们是否能帮你解决问题。

我建议更新到ngmoco cache money's fork,它包含了许多未包含在主线缓存资金存储库中的错误修复。

我在使用acts as taggable on和cache MONY 0.2.5时遇到了这个错误

看来
@cache\u config
没有在
actsastaggaleon::Tag
类上设置

如果打开cache-money-0.2.5/lib/cash/config.rb并删除:

   attr_reader :cache_config
   delegate :repository, :indices, :to => :@cache_config
并将其替换为:

   def cache_config
     @cache_config ? @cache_config : superclass.cache_config
   end

   delegate :repository, :indices, :to => :cache_config
这将使用
actsastaggaleon::Tag
超类的缓存配置


适合我。

我们需要更多信息,堆栈跟踪会很有用。