Sha256: 51c75580bb9a903ba6f3df0cd367be150046a62842fb2d71e4c38c8faf672294

Contents?: true

Size: 586 Bytes

Versions: 4

Compression:

Stored size: 586 Bytes

Contents

require "active_support/concern"

module ActionControllerTweaks
  module Caching
    extend ActiveSupport::Concern

    HEADERS = {
      # HTTP 1.1
      "Cache-Control" => "no-cache, no-store, pre-check=0, post-check=0",
      # HTTP 1.0
      "Pragma"        => "no-cache",
      # HTTP 1.0
      "Expires"       => "Mon, 01 Jan 1990 00:00:00 GMT",
    }.freeze

    included do
      private

      # Should be more powerful than #expire_now
      def set_no_cache
        HEADERS.each do |key, value|
          response.headers[key] = value
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
action_controller_tweaks-0.3.7 lib/action_controller_tweaks/caching.rb
action_controller_tweaks-0.3.6 lib/action_controller_tweaks/caching.rb
action_controller_tweaks-0.3.5 lib/action_controller_tweaks/caching.rb
action_controller_tweaks-0.3.4 lib/action_controller_tweaks/caching.rb