Class: Alchemy::JsonApi::NodesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/alchemy/json_api/nodes_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/alchemy/json_api/nodes_controller.rb', line 6

def index
  @nodes = node_scope.select(:id, :updated_at)
  if stale?(last_modified: @nodes.maximum(:updated_at), etag: @nodes)
    jsonapi_paginate(node_scope_with_includes) do |paginated|
      render jsonapi: paginated
    end
  end

  expires_in cache_duration, { public: true, must_revalidate: true }
end