Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the load order issues of Sweeping module #8

Merged
merged 1 commit into from
Jul 18, 2013
Merged

Fix the load order issues of Sweeping module #8

merged 1 commit into from
Jul 18, 2013

Conversation

tiegz
Copy link
Contributor

@tiegz tiegz commented Jul 12, 2013

WHAT

Remove Concern from the Sweeping module so we can directly extend it in ActionController::Base

WHY

Basically this is what happens, in the context of ActionController when the app is booting:

  1. Base loads and includes the Caching module
  2. rails-observers railtie is then triggered to include Caching::Sweeping concern as a dependency of Caching, but it doesn't actually get included because Caching is a concern too.
  3. However Caching was already included in step 1, so Caching::Sweeping never gets included in Base and people run into this error: Undefined method `cache_sweeper' or uninitialized constant ActionController::Caching::Sweeper #4

Note: the tests for this were working before because it didn't use the railtie to load Sweeping. It just directly loaded the files with Sweeping in them before it loaded ActionController::Base.

FIXES

#4

@tiegz
Copy link
Contributor Author

tiegz commented Jul 12, 2013

(this is the simplest solution I had. Other possibilities include moving Sweeping out of the Caching module)

@tiegz
Copy link
Contributor Author

tiegz commented Jul 13, 2013

just found the same issue in thsi gem: https://github.com/rails/actionpack-page_caching

And I assume it exists here too: https://github.com/rails/actionpack-action_caching

So I guess whatever solution we use here can be applied in those.

guilleiguaran added a commit that referenced this pull request Jul 18, 2013
Fix the load order issues of Sweeping module
@guilleiguaran guilleiguaran merged commit b614184 into rails:master Jul 18, 2013
@khustochka
Copy link

Hi @tiegz

Thanks for your work.

Just for the record I never had problems with actionpack-page_caching similar to those I had with rails-observers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants