Class: Spree::Api::V2::ResourceController

Inherits:
BaseController
  • Object
show all
Includes:
Caching, CollectionOptionsHelpers
Defined in:
app/controllers/spree/api/v2/resource_controller.rb

Instance Method Summary collapse

Methods included from Caching

#collection_cache_key, #collection_cache_opts

Methods included from CollectionOptionsHelpers

#collection_links, #collection_meta, #collection_permitted_params

Methods inherited from BaseController

#content_type

Instance Method Details

#indexObject



8
9
10
11
12
13
14
# File 'app/controllers/spree/api/v2/resource_controller.rb', line 8

def index
  render_serialized_payload do
    Rails.cache.fetch(collection_cache_key(paginated_collection), collection_cache_opts) do
      serialize_collection(paginated_collection)
    end
  end
end

#showObject



16
17
18
# File 'app/controllers/spree/api/v2/resource_controller.rb', line 16

def show
  render_serialized_payload { serialize_resource(resource) }
end