Sha256: 532327cc9df2b69419ea64c8e63b7fbdb1432f76d3f2c11f28890b3a2c579b22

Contents?: true

Size: 643 Bytes

Versions: 2

Compression:

Stored size: 643 Bytes

Contents

require "active_support/concern"

module ActionControllerTweaks
  module Caching
    extend ActiveSupport::Concern

    HEADERS = {
      # HTTP 1.1
      "Cache-Control" => "no-cache, no-store, max-age=0, "\
                         "must-revalidate, pre-check=0, post-check=0",
      # HTTP 1.0
      "Pragma"        => "no-cache",
      # HTTP 1.0
      "Expires"       => "Fri, 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

2 entries across 2 versions & 1 rubygems

Version Path
action_controller_tweaks-0.3.3 lib/action_controller_tweaks/caching.rb
action_controller_tweaks-0.3.2 lib/action_controller_tweaks/caching.rb