Forum: Ruby on Rails ActionController::Caching::Sweeper not autoloading in 2.3.0 RC1

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ef9ecd30591995af2cf62cde10b26e49?d=identicon&s=25 Wincent Colaiuta (Guest)
on 2009-02-04 17:51
(Received via mailing list)
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
Ef9ecd30591995af2cf62cde10b26e49?d=identicon&s=25 Wincent Colaiuta (Guest)
on 2009-02-15 19:48
(Received via mailing list)
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
This topic is locked and can not be replied to.