Module: NoCacheControl
- Defined in:
- lib/no_cache_control.rb,
lib/no_cache_control/version.rb
Constant Summary collapse
- VERSION =
"1.0.0"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/no_cache_control.rb', line 4 def self.included(base) begin base.before_action :set_no_cache_control rescue NoMethodError base.before_filter :set_no_cache_control end end |
Instance Method Details
#set_no_cache_control ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/no_cache_control.rb', line 12 def set_no_cache_control response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" # Pragma and Expires are not a true header defined in RFC, however some browsers accepts them response.headers["Pragma"] = "no-cache" response.headers["Expires"] = '-1' end |