Module: Shipit::Api::Cacheable

Included in:
BaseController
Defined in:
app/controllers/concerns/shipit/api/cacheable.rb

Instance Method Summary collapse

Instance Method Details

#render_resource(resource) ⇒ Object



10
11
12
# File 'app/controllers/concerns/shipit/api/cacheable.rb', line 10

def render_resource(resource, *)
  super if stale?(etag: resource, last_modified: resource.updated_at, template: false)
end

#render_resources(resources) ⇒ Object



6
7
8
# File 'app/controllers/concerns/shipit/api/cacheable.rb', line 6

def render_resources(resources, *)
  super if stale?(etag: resources, last_modified: resources.map(&:updated_at).max, template: false)
end