Skip to content

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

Closed
@jesenko

Description

@jesenko

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions