Sha256: ca63884992f2685ff1072fe2401e63dfafdfb39e6d9ed73412834f404e139dbf

Contents?: true

Size: 584 Bytes

Versions: 2

Compression:

Stored size: 584 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
      "no-cache" => "no-cache", # HTTP 1.0
      "Expires" => "Fri, 01 Jan 1990 00:00:00 GMT", # Proxies
    }.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.2.0 lib/action_controller_tweaks/caching.rb
action_controller_tweaks-0.1 lib/action_controller_tweaks/caching.rb