ActionController::Caching::Sweeper not autoloading in 2.3.0 RC1

90 views
Skip to first unread message

Wincent Colaiuta

unread,
Feb 4, 2009, 11:50:09 AM2/4/09
to Ruby on Rails: Talk
Just updated to 2.3.0 RC1 and I'm finding that my sweepers are
throwing NameErrors (uninitialized constant
ActionController::Caching::Sweeper) when evaluation reaches lines like
this one:

class PostSweeper < ActionController::Caching::Sweeper

This only happens in the development environment, because that's the
only environment where I have "cache_classes" set to false. Relevant
stack trace is:

vendor/rails/activesupport/lib/active_support/dependencies.rb:440:in
`load_missing_constant'
vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in
`const_missing'
app/sweepers/post_sweeper.rb:1
vendor/rails/activesupport/lib/active_support/dependencies.rb:380:in
`load_without_new_constant_marking'
vendor/rails/activesupport/lib/active_support/dependencies.rb:380:in
`load_file'
vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in
`new_constants_in'
vendor/rails/activesupport/lib/active_support/dependencies.rb:379:in
`load_file'
vendor/rails/activesupport/lib/active_support/dependencies.rb:259:in
`require_or_load'
vendor/rails/activesupport/lib/active_support/dependencies.rb:425:in
`load_missing_constant'
vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in
`const_missing'
vendor/rails/activesupport/lib/active_support/dependencies.rb:92:in
`const_missing'
vendor/rails/actionpack/lib/action_controller/caching/sweeping.rb:
43:in `const_get'
vendor/rails/actionpack/lib/action_controller/caching/sweeping.rb:
43:in `cache_sweeper'
vendor/rails/actionpack/lib/action_controller/caching/sweeping.rb:
41:in `each'
vendor/rails/actionpack/lib/action_controller/caching/sweeping.rb:
41:in `cache_sweeper'
app/controllers/posts_controller.rb:5

I can get rid of the error by manually adding the following at the top
of the sweeper file:

require 'rails/actionpack/lib/action_controller/caching/sweeping'

But that's really bizarre, because I can see from the stack trace that
that file has already been evaluated!

Any idea what's going on here? I created a fresh Rails app and tried
to make a minimal test case but wasn't able to reproduce, so there's
something subtle going on.

Cheers,
Wincent

Wincent Colaiuta

unread,
Feb 15, 2009, 1:47:10 PM2/15/09
to Ruby on Rails: Talk
I've done a bit more digging and narrowed down the source of the bug.
See:

http://rails.lighthouseapp.com/projects/8994/tickets/1977

Cheers,
Wincent
Reply all
Reply to author
Forward
0 new messages