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

ActionController:Caching::Sweeper callbacks ignore the cache_sweeper configuration #27

Closed
jesenko opened this issue Jul 23, 2014 · 0 comments · May be fixed by #28
Closed

ActionController:Caching::Sweeper callbacks ignore the cache_sweeper configuration #27

jesenko opened this issue Jul 23, 2014 · 0 comments · May be fixed by #28

Comments

@jesenko
Copy link
Contributor

jesenko commented Jul 23, 2014

Documentation is not clear on the usage of cache sweeper. From the examples it appears that the ActiveRecord observers are active only if the sweeper is activated in the controller via cache_sweeper method. However, this is not true - they are just the ordinary AR observers, which in addition also receive callback from the controller. In controller callbacks, @controller variable is set to current controller, while method_missing is rerouted to the @controller. This is why the examples in documentation work - calls to the expire_page and expire_action are routed to the controller only if @controller is set. However, due to rails/rails@91cb99e, if the controller is not set, these methods now raise method_missing exception when sweeper is called outside controller scope.

In documentation it is also not documented how to use controller callbacks explicitly (sweeper should implement controller_callback_method_name or action_callback_method_name).

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