Override method of module ActionController::Caching::Actions

91 Views Asked by At

I want to override the caching_allowed? to accept caching a POST request based on some condition. How do I do that?

I have tried the below in a initializer file. But it does not work.

require "set"

module ActionController
  module Caching
    module Actions
      def caching_allowed?
        # condition
        # change code
      end
    end
  end
end

Update:

This method is called using current controller object. So I just override the method inside the particular controller and it works.

0

There are 0 best solutions below