module Desponders::HttpCacheResponder

Public Instance Methods

to_format() click to toggle source
Calls superclass method
# File lib/desponders/http_cache_responder.rb, line 3
def to_format
  return if do_http_cache? && do_http_cache!

  super
end

Private Instance Methods

do_http_cache!() click to toggle source
# File lib/desponders/http_cache_responder.rb, line 16
def do_http_cache!
  controller.fresh_when(etag: resource,
                        last_modified: resource.updated_at,
                        public: false)
end
do_http_cache?() click to toggle source
# File lib/desponders/http_cache_responder.rb, line 11
def do_http_cache?
  get? && ActionController::Base.perform_caching &&
  resource.respond_to?(:updated_at)
end