Skip to content

Instantly share code, notes, and snippets.

@emk
Created December 6, 2008 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emk/32568 to your computer and use it in GitHub Desktop.
Save emk/32568 to your computer and use it in GitHub Desktop.
# Gotcha! articles_controller.rb is getting loaded twice
# and registering our sweepers twice.
#
# This was the critical hint:
# http://blog.pastie.org/2008/12/passenger-wtf-1-nilcontroller_name-in-sweepers-module.html
mephisto (rails-2.2)$ ruby test/functional/admin/articles_controller_permissions_test.rb
Setting up Admin::SectionsController
Setting up Admin::SectionsController
Loaded suite test/functional/admin/articles_controller_permissions_test
Started
Setting controller articles to nil in #<AssignedSectionSweeper:0x24d7180>
Setting controller articles to nil in #<ArticleSweeper:0x24da90c>
Controller missing in #<AssignedSectionSweeper:0x24d7180>
Controller missing in #<ArticleSweeper:0x24da90c>
E
...
1) Error:
test_should_create_article(Admin::ArticlesControllerPermissionsTest):
NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.controller_name
/Users/emk/w/src/mephisto/vendor/rails/actionpack/lib/action_controller/caching/sweeping.rb:87:in `callback'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment