This project is archived and is in readonly mode.

#1977 ✓resolved
Wincent Colaiuta

ActionController::Caching::Sweeper autoloading is broken

Reported by Wincent Colaiuta | February 15th, 2009 @ 06:45 PM | in 2.x

Originally posted this as a question to the rubyonrails-talk Google group:

http://groups.google.com/group/r...

Quoting from that message:

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

On further digging, I've narrowed things down to commit 31ce92f7b5784bc5b6a441e88cd734c7b8b1c58f, "Use autoload instead of explicit requires for ActionController".

Basically, when:


require 'action_controller/caching/sweeping'

Was ripped out in favor of:


autoload :Sweeping, 'action_controller/caching/sweeping'

Things break because the constant in question is not actually "Sweeping" but "Sweeper" (see line 56 of "actionpack/lib/action_controller/caching/sweeping.rb").

I imagine the issue is relatively common because when you write a sweeper you do it with:


class PostSweeper < ActionController::Caching::Sweeper

And don't actually make reference to the "Sweeping" constant mentioned in the autoload line.

The fix? Conservatively I guess the fix is to add another autoload line:


autoload :Sweeper, 'action_controller/caching/sweeping'

Alternatively, if you think that nobody actually uses the "Sweeping" module directly, then you could actually replace the existing autoload line with the above.

Comments and changes to this ticket

  • Wincent Colaiuta
  • Wincent Colaiuta

    Wincent Colaiuta February 15th, 2009 @ 07:02 PM

    • Tag changed from 2.3.0, patch to 2.3.0

    Sigh, forget that patch I just attached. "autoload" evidently doesn't work like I thought it did.

  • Wincent Colaiuta

    Wincent Colaiuta February 15th, 2009 @ 07:13 PM

    Further digging shows that at the time "actionpack/lib/action_controller/caching/sweeping.rb" is evaluated, the "Sweeper" class can't be defined yet because either ActiveRecord or ActiveRecord::Observer isn't defined yet...

    
    if defined?(ActiveRecord) and defined?(ActiveRecord::Observer)¶
      class Sweeper < ActiveRecord::Observer #:nodoc:¶
    

    If I fire up a "script/console" session, I see "action_controller/caching/sweeping.rb" being immediately evaluated, but ActionController::Caching::Sweeper does not get defined.

    If I require "action_controller/caching/sweeping.rb", nothing is evaluated because the file has already been loaded, so "require" does nothing.

    If I force re-evaluation of the file by using a different path in my "require", './vendor/rails/actionpack/lib/action_controller/caching/sweeping.rb', for instance, then ActionController::Caching::Sweeper does get defined.

    So is there any way to change the load order, so that by the time "sweeping.rb" gets evaluated ActiveRecord and ActiveRecord::Observer are defined?

  • Wincent Colaiuta

    Wincent Colaiuta February 15th, 2009 @ 07:38 PM

    Looking at this, the "correct" (robust) solution seems to be to:

    1. Move the Sweeper class out into a separate file, seeing as it depends on ActiveRecord::Observer.
    2. Add an "autoload" line for Sweeper, leaving the existing "autoload" for Sweeping in place.
    3. In Sweeper's new file, require ActiveRecord/ActiveRecord::Observer.

    Sound ok? If so, I can whip up a patch.

  • Wincent Colaiuta

    Wincent Colaiuta February 16th, 2009 @ 10:35 AM

    Ok, I now have a relatively minimal test case that demonstrates the problem.

    First up, create a new Rails app with a minimal resource:

    
    rails demo
    cd demo
    script/generate resource foo
    rake db:migrate
    

    Set up a sweeper:

    
    echo "class FooSweeper < ActionController::Caching::Sweeper; end" > app/models/foo_sweeper.rb
    

    Add a "cache_sweeper" line and a basic index action to the "app/controllers/foos_controller.rb":

    
    cache_sweeper :foo_sweeper
    def index; end
    

    Set up the corresponding view template:

    
    touch app/views/foos/index.html.erb
    

    To actually trigger the issue, I had to install Haml, so add this line to "config/environment.rb":

    
    config.gem 'haml', :version => '2.0.8'
    

    And unpack it (I guess this step is optional):

    
    rake gems:unpack
    

    Now the critical step... add this to "config/environments/development.rb":

    
    Sass::Plugin.options[:always_update] = true
    Sass::Plugin.options[:always_check] = true
    

    It doesn't matter what configuration you actually add in there; the important thing is to access the "Sass::Plugin" constant from inside the environment file...

    Now start up the server:

    
    script/server
    

    And try hitting a URL like http://localhost:3000/foos

    Voila, there's your "Uninitialized constant ActionController::Caching::Sweeper" exception.

    I discovered this by printing out a backtrace from within "actionpack/lib/action_controller/caching/sweeping.rb". Here I could see that:

    1. The "sweeping.rb" file was evaluated for the first time because the "sass/plugin.rb" file references ActionController
    2. At the time "sweeping.rb" is evaluated, ActiveRecord is already defined by ActiveRecord::Observer is not, so the Sweeper class never gets defined

    Here's the backtrace:

    
        /private/tmp/demo/vendor/rails/actionpack/lib/action_controller/caching/sweeping.rb:59
        /private/tmp/demo/vendor/rails/actionpack/lib/action_controller/caching.rb:43:in `included'
        /private/tmp/demo/vendor/rails/actionpack/lib/action_controller/caching.rb:33:in `class_eval'
        /private/tmp/demo/vendor/rails/actionpack/lib/action_controller/caching.rb:33:in `included'
        /private/tmp/demo/vendor/rails/actionpack/lib/action_controller/base.rb:1350:in `include'
        /private/tmp/demo/vendor/rails/actionpack/lib/action_controller/base.rb:1350
        /private/tmp/demo/vendor/rails/actionpack/lib/action_controller/base.rb:1345:in `each'
        /private/tmp/demo/vendor/rails/actionpack/lib/action_controller/base.rb:1345
        /private/tmp/demo/vendor/rails/actionpack/lib/action_controller/base.rb:1344:in `class_eval'
        /private/tmp/demo/vendor/rails/actionpack/lib/action_controller/base.rb:1344
        /private/tmp/demo/vendor/gems/haml-2.0.8/lib/sass/plugin/rails.rb:11
        /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
        /private/tmp/demo/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
        /private/tmp/demo/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
        /private/tmp/demo/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
        /private/tmp/demo/vendor/gems/haml-2.0.8/lib/sass/plugin.rb:168
        /private/tmp/demo/vendor/rails/activesupport/lib/active_support/dependencies.rb:380:in `load_without_new_constant_marking'
        /private/tmp/demo/vendor/rails/activesupport/lib/active_support/dependencies.rb:380:in `load_file'
        /private/tmp/demo/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
        /private/tmp/demo/vendor/rails/activesupport/lib/active_support/dependencies.rb:379:in `load_file'
        /private/tmp/demo/vendor/rails/activesupport/lib/active_support/dependencies.rb:259:in `require_or_load'
        /private/tmp/demo/vendor/rails/activesupport/lib/active_support/dependencies.rb:425:in `load_missing_constant'
        /private/tmp/demo/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `const_missing'
        /private/tmp/demo/config/environments/development.rb:21:in `load_environment'
        ./script/../config/../vendor/rails/railties/lib/initializer.rb:356:in `load_environment'
        /private/tmp/demo/vendor/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
        ./script/../config/../vendor/rails/railties/lib/initializer.rb:349:in `load_environment'
        ./script/../config/../vendor/rails/railties/lib/initializer.rb:138:in `process'
        ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
        ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
        /private/tmp/demo/config/environment.rb:9
        /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
        /private/tmp/demo/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
        /private/tmp/demo/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
        /private/tmp/demo/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
        /private/tmp/demo/vendor/rails/railties/lib/commands/server.rb:82
        /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
        script/server:3
    

    So one workaround I have available to me is to drop the Sass configuration from my "config/environments/development.rb" file, and instead put it in an initializer in "config/initializers" inside a conditional "if ENV['RAILS_ENV'] == 'development'" block.

    But I think a more robust fix might be to make the changes I suggested in my last comment. Like I said, if someone thinks this is a good idea, please let me know and I'll prepare a patch.

  • Repository

    Repository February 16th, 2009 @ 08:38 PM

    • State changed from “new” to “resolved”

    (from [460269dcafd6d190d51176b2b03e65f3f44669b8]) Autoload ActionController::Caching::Sweeper constant [#1977 state:resolved] http://github.com/rails/rails/co...

  • LacKac

    LacKac February 26th, 2009 @ 03:14 PM

    I still have this issue. I think Wincent's solution should solve this.

  • Wincent Colaiuta

    Wincent Colaiuta February 26th, 2009 @ 07:45 PM

    Yes, it would. But...

    ...So the bug is that since the changes were made to Rails' class caching, and since switching to using "autoload" pervasively, Rails has become a lot more sensitive to certain load-ordering issues.

    And it's true that my suggested fix would address this one particular case.

    But having said all that, I realized that the way to fix my problem was to move my Sass stuff out of environments/development.rb and into an initializer in config/initializers.

    
    if ENV['RAILS_ENV'] == 'development'
      Sass::Plugin.options[:always_update] = true
      Sass::Plugin.options[:always_check] = true
    end
    

    You could argue that it's a bug that Rails has become less tolerant about where it accepts this kind of thing, but I think more than anything it's a documentation bug.

    Turns out that this is only the last of several issues that I've run into at startup time since these changes were made to Rails. I've come to the conclusion that pretty much the only thing it is safe to use inside config/environment.rb and config/environments/.rb are "config." statements. Pretty much everything else needs to go in an initializer to avoid this kind of problem.

    About the only thing that would have helped me avoid these issues would have been a big warning in the release notes, or a comment in the actual environment files advising that pretty much the only thing that should go in them should be "config.*" statements. I probably only ran into the issue because I was updating an app that was started with a significantly older version of Rails.

    It is a bit of a step backwards that you have to put this kind of stuff inside an "if" that explicitly checks RAILS_ENV rather than just sticking it in config/environments/development.rb like you used to. But I doubt anyone is going to be willing to do the work to make all that work again.

  • Chris Nichols

    Chris Nichols March 14th, 2009 @ 12:33 AM

    I'm still seeing and error with RC2.

    
    => Rails 2.3.1 application starting on http://0.0.0.0:3000
    /Users/chris/workspace/petflight/vendor/rails/activesupport/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant ActionController::Caching::Sweeper (NameError)
    	from /Users/chris/workspace/petflight/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `const_missing'
    	from /Users/chris/workspace/petflight/app/sweepers/definition_sweeper.rb:1
    	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
    	from /Users/chris/workspace/petflight/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require'
    	from /Users/chris/workspace/petflight/vendor/rails/activesupport/lib/active_support/dependencies.rb:265:in `require_or_load'
    	from /Users/chris/workspace/petflight/vendor/rails/activesupport/lib/active_support/dependencies.rb:425:in `load_missing_constant'
    	from /Users/chris/workspace/petflight/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `const_missing'
    	 ... 26 levels...
    	from /Users/chris/workspace/petflight/vendor/rails/railties/lib/commands/server.rb:84
    	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
    	from ./script/server:3
    
  • Kivanio Barbosa

    Kivanio Barbosa March 16th, 2009 @ 03:04 PM

    • Tag changed from 2.3.0 to 2.3.2

    i'm still seeing and error wirh 2.3.2.

    /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:440:in load_missing_constant': uninitialized constant ActionController::Caching::Sweeper (NameError)

    from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in `const_missing'
    from ./spec/../lib/user_stamp.rb:29
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
    from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
    from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
    from ./spec/spec_helper.rb:14
    from ./spec/user_stamp_class_methods_spec.rb:1:in `require'
    from ./spec/user_stamp_class_methods_spec.rb:1
    from /Library/Ruby/Gems/1.8/gems/rspec-1.2.0/lib/spec/runner/example_group_runner.rb:15:in `load'
    from /Library/Ruby/Gems/1.8/gems/rspec-1.2.0/lib/spec/runner/example_group_runner.rb:15:in `load_files'
    from /Library/Ruby/Gems/1.8/gems/rspec-1.2.0/lib/spec/runner/example_group_runner.rb:14:in `each'
    from /Library/Ruby/Gems/1.8/gems/rspec-1.2.0/lib/spec/runner/example_group_runner.rb:14:in `load_files'
    from /Library/Ruby/Gems/1.8/gems/rspec-1.2.0/lib/spec/runner/options.rb:87:in `run_examples'
    from /Library/Ruby/Gems/1.8/gems/rspec-1.2.0/lib/spec/runner/command_line.rb:9:in `run'
    from /Library/Ruby/Gems/1.8/gems/rspec-1.2.0/bin/spec:4
    
    

    rake aborted! Command /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"/Library/Ruby/Gems/1.8/gems/rspec-1.2.0/lib" "/Library/Ruby/Gems/1.8/gems/rspec-1.2.0/bin/spec" "spec/user_stamp_class_methods_spec.rb" "spec/user_stamp_spec.rb" "spec/user_stamp_sweeper_spec.rb" --colour --format progress --loadby mtime --reverse failed

    (See full trace by running task with --trace)

  • francois

    francois March 16th, 2009 @ 08:45 PM

    I'm getting this error as well when using Rails 2.3.2

    Here are some more specifics:

    if I put this line:

    ActionController::Base.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"

    in either development.rb or in environment.rb then I receive this error:

    undefined method cache_sweeper' for Admin::BoardroomsController:Class </code>

    However, if I put the cache_store command in an initializer then everything seems to work just fine.

  • Ben Reubenstein

    Ben Reubenstein March 17th, 2009 @ 08:42 PM

    Having this issue as well, can we get this ticket reopened? Should we start a new one?

  • Brad Folkens

    Brad Folkens March 18th, 2009 @ 02:21 AM

    I had this problem too. A workaround (for the time-being) is to force ActiveRecord to load first in the config. I added a line with ActiveRecord::Base to development/production/test.rb.

  • Gudata

    Gudata March 18th, 2009 @ 08:18 AM

    rails 2.3.2 has the same problem.

  • Chris Heald

    Chris Heald March 18th, 2009 @ 07:44 PM

    I have this problem in 2.3.2, as well. I haven't troubleshot what's causing it, but adding "ActiveRecord::Base" as the first line of my environment config files does fix it.

  • Gudata

    Gudata March 19th, 2009 @ 11:34 AM

    If you get this error maybe you are upgrading your app from an older rails version and you should check whats triggering the loading of AR in your environment.rb earlier.

    In my case it was lines:

    
    ActionController::Base.logger = Logger.new(STDOUT)
    ActionController::Base.logger.level = Logger::INFO
    ActiveRecord::Base.logger = Logger.new(STDOUT)
    ActiveRecord::Base.logger.level = Logger::INFO
    

    After commenting them everthing was ok.

    Very big thanks to W. Colaiuta for defining the problem.

    He also has proposed another fix of this issue that will work better with most of the existing rails apps

  • Brad Folkens

    Brad Folkens March 19th, 2009 @ 02:17 PM

    For me it was:

    ActionController::Base.session_options[:domain] = ...

  • ronin-52463 (at lighthouseapp)

    ronin-52463 (at lighthouseapp) March 31st, 2009 @ 09:28 AM

    Despite all these tweaks, I still had the problem after upgrading from 2.2.2 to 2.3.2

    In config/environnements/development.rb, I had

    
    ActionController::Base.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"
    

    After reading the Rails Guides, I found that I could/should write

    
    config.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"
    

    And it worked !

    In my case I found the culprit to be the cache_store definition, but I think the problem is more about calling ActionController directly and not the cache_store call itself.

  • Gravis

    Gravis April 10th, 2009 @ 02:20 PM

    I'm sorry, but I'm still having the issue, and don't understand how to solve it. I'm migrating a rails 2.2.3 app to 2.3.2, and since my subdomain cookie don't work any more, I've changed :

    ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(:domain => ".mydomain.com")
    
    

    to

    ActionController::Base.session_options[:domain] = ".mydomain.com"
    
    

    Now I get this famous uninitialized constant ActionController::Caching::Sweeper error. I've tried some of the tips in this ticket without success anyway :(

    Thx

  • stanislav

    stanislav April 10th, 2009 @ 02:25 PM

    You can add these lines to your production.rb, development.rb ....

    this is a workaround for problems with loading caching sweepers

    ActiveRecord::Base

    So you should just load AR:B first.

  • Gravis

    Gravis April 10th, 2009 @ 02:26 PM

    Update : I've corrected the issue by using :

    
    Rails.configuration.action_controller.session[:domain] = '.staging.mydomain.net'
    

    in my config/environments/staging.rb file.

  • stanislav

    stanislav April 10th, 2009 @ 02:27 PM

    Ups, a strange formatting.....

    The workaround is just to add this line: ActiveRecord::Base In the begging of your production.rb, development.rb ....

  • Gravis

    Gravis April 10th, 2009 @ 02:32 PM

    @stanislav : thx, what do you mean by adding these line ?

    just

    ActiveRecord::Base
    
    

    ? I get a NameError: uninitialized constant ActiveRecord error when doing this, I guess I'm doing something wrong :(

  • Ozgun Ataman

    Ozgun Ataman April 11th, 2009 @ 11:01 PM

    Still having this issue when working with Rails 2.3.2.

  • Ozgun Ataman

    Ozgun Ataman April 11th, 2009 @ 11:48 PM

    Even after removing all reference so ActionController direclty within the environment initializers, the sweepers are still not working.

    • Application loads successfully
    • Caching works as expected
    • Sweeper ActiveRecord observers don't seem to be properly hooked into callbacks, as their methods do not get called.

    This is when using Rails 2.3.2

  • Michael Koziarski

    Michael Koziarski April 22nd, 2009 @ 12:38 AM

    • State changed from “resolved” to “open”

    I see this too, wincent, can you please provide a patch along the lines you indicated.

  • Wincent Colaiuta

    Wincent Colaiuta April 22nd, 2009 @ 10:34 AM

    • Tag changed from 2.3.2 to 2.3.2, patch

    Ok, here's a patch against the 2-3-stable branch. The test suite passes but I haven't been able to actually test this out on a sample app because I don't know how to run the "rails" command or install gems from the branch... So perhaps someone who knows how to do that can try it out.

  • Repository

    Repository May 5th, 2009 @ 02:18 AM

    • State changed from “open” to “resolved”

    (from [5ac05f15c6d8f496c4e152dbbecd8ccb12041770]) Extract ActionController::Caching::Sweeper into separate file [#1977 state:resolved]

    Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...

  • Olly Headey

    Olly Headey May 8th, 2009 @ 02:22 PM

    I'm running the latest 2-3-stable branch with the above patch included but I'm still seeing the issue.

    
    /Users/Me/MyApp/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant ActionController::Caching::Sweeper (NameError)
    	from /Users/Me/MyApp/Code/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `const_missing'
    	from /Users/Me/MyApp/Code/trunk/app/sweepers/bank_sweeper.rb:1
    	from /Users/Me/MyApp/Code/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:380:in `load_without_new_constant_marking'
    	from /Users/Me/MyApp/Code/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:380:in `load_file'
    	from /Users/Me/MyApp/Code/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    	from /Users/Me/MyApp/Code/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:379:in `load_file'
    	from /Users/Me/MyApp/Code/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:259:in `require_or_load'
    	from /Users/Me/MyApp/Code/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:425:in `load_missing_constant'
    	 ... 38 levels...
    	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    
  • David Reese

    David Reese May 9th, 2009 @ 10:32 PM

    Ditto on this error with the most recent 2.3 -- I was not having the issue before, and it seems the most recent commit actually caused it.

    Also, action_controller/caching/sweeper.rb has a syntax error -- it's missing an "end". No kidding --

    http://github.com/rails/rails/bl...

  • Andreas Korth

    Andreas Korth June 1st, 2009 @ 06:23 PM

    I can confirm that the patch does not fix the bug on 2.3.2 and no workaround mentioned in this discussion works for me.

    Can someone please reopen this ticket. This is very frustrating.

  • Michael Koziarski

    Michael Koziarski June 1st, 2009 @ 10:05 PM

    Andreas,

    This is fixed in 2-3-stable isn't it?

  • Olly Headey

    Olly Headey June 1st, 2009 @ 10:16 PM

    Just thought I'd point out that it's working for me now

  • Andreas Korth

    Andreas Korth June 1st, 2009 @ 10:29 PM

    Michael,

    I'm still having this issue in Rails 2.3.2. It might be worth noting that the sweeper class is inside a plugin. Some of the reports indicate that the bug depends on the (auto)load order of classes.

    The NameError does not occur if I explicitely require the file that defines ActionController::Caching::Sweeper in an initializer, like so:

    require "#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/caching/sweeping.rb"

    What baffles me is that there is no sweeper.rb file in actionpack-2.3.2/lib/action_controller/caching/. I thought the patch involved moving ActionController::Caching::Sweeper into a separate file.

  • Michael Koziarski

    Michael Koziarski June 1st, 2009 @ 10:31 PM

    Andreas,

    We're aware of the problem in 2.3.2, however I'm pretty sure it's
    fixed in 2-3-stable (a branch in git). If you're able to confirm
    that, then I'll know we're good to go and we can release 2.3.3 in a
    few days which will include this fix.

  • Andreas Korth

    Andreas Korth June 1st, 2009 @ 10:44 PM

    Michael,

    I'm sorry there was a misunderstanding. I thought the bug was fixed in 2.3.2. I tried 2-3-stable and it works fine.

    Thanks for working this out with me :)

    I'm looking forward to 2.3.3!

  • Ryan Bigg

    Ryan Bigg November 8th, 2010 @ 01:50 AM

    • Tag cleared.
    • Importance changed from “” to “Low”

    Automatic cleanup of spam.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages