Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8662 (closed defect: fixed)

Opened 1 year ago

Last modified 9 months ago

Changeset 6833 breaks ActionController::Caching::Fragments::MemCacheStore during 'rake test'

Reported by: mattb Assigned to: rick
Priority: normal Milestone: 1.2 regressions
Component: ActiveSupport Version: edge
Severity: normal Keywords: memcache
Cc:

Description

My application uses :mem_cache_store for fragment caching, but not for caches_action or caches_page.

Running my app against svn revision 6832, my tests run fine. If I update to revision 6833 or any later revision at current time of writing, I get the following exception when I attempt to run any test:

/app/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:477:in `const_missing': uninitialized constant ActionController::Caching::Fragments::MemCacheStore::MemCache (NameError)

from /app/vendor/rails/actionpack/lib/action_controller/caching.rb:484:in `initialize' from /app/vendor/rails/actionpack/lib/action_controller/caching.rb:338:in `new' from /app/vendor/rails/actionpack/lib/action_controller/caching.rb:338:in `fragment_cache_store=' ... etc ...

The line in caching.rb in question is:

@data = MemCache.new(*addresses)

so it would appear to be a simple problem of the memcache libraries not being loaded.

The problem does not appear to affect the app running in development or production mode.

Changeset 6833 introduced demand-loading in ActiveRecord but did not touch ActionController.

Change History

06/15/07 19:04:24 changed by mattb

Adding:

require 'rubygems' require 'memcache'

to the end of config/environments/test.rb worked around this problem for me.

10/03/07 14:52:59 changed by rick

  • status changed from new to closed.
  • resolution set to fixed.

(In [7725]) Use #require_library_or_gem to load the memcache library for the MemCache session and fragment cache stores. Closes #8662. [Rick]

10/03/07 15:24:16 changed by danielmorrison

  • status changed from closed to reopened.
  • resolution deleted.

Rick, now it breaks if you don't have memcahe-client installed, because its getting required for everyone.

require_library_or_gem 'memcache'

uninitialized constant ActionController::Caching::Sweeper::Reloadable

10/03/07 15:31:07 changed by danielmorrison

  • owner changed from core to rick.
  • status changed from reopened to new.

10/03/07 16:05:18 changed by tom

Yes, this broke my (non-MemCache) application too.

10/03/07 16:16:25 changed by technoweenie

  • status changed from new to closed.
  • resolution set to fixed.

Sorry about that, should be fixed now.

10/03/07 16:19:32 changed by tom

Thanks. Works for me.