Sha256: f9824e83de85511b6651e386f1e05dd7d9cd0b92d29ce699b72f5fc757fb38b0

Contents?: true

Size: 583 Bytes

Versions: 2

Compression:

Stored size: 583 Bytes

Contents

require 'active_support/concern'

module ActionControllerTweaks
  module Caching
    extend ActiveSupport::Concern

    HEADERS = {
      "Cache-Control" => "no-cache, no-store, max-age=0, must-revalidate, pre-check=0, post-check=0", # HTTP 1.1
      "Pragma" => "no-cache", # HTTP 1.0
      "Expires" => "Fri, 01 Jan 1990 00:00:00 GMT", # HTTP 1.0
    }.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.1 lib/action_controller_tweaks/caching.rb
action_controller_tweaks-0.3.0 lib/action_controller_tweaks/caching.rb