Class: Spree::Api::V1::TagsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/api/v1/tags_controller.rb

Instance Attribute Summary

Attributes inherited from BaseController

#current_api_user

Instance Method Summary collapse

Methods inherited from BaseController

#content_type, #permitted_line_item_attributes

Methods included from ControllerSetup

included

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/spree/api/v1/tags_controller.rb', line 5

def index
  @tags =
    if params[:ids]
      Tag.where(id: params[:ids].split(',').flatten)
    else
      Tag.ransack(params[:q]).result
    end

  @tags = @tags.page(params[:page]).per(params[:per_page])

  expires_in 15.minutes, public: true
  headers['Surrogate-Control'] = "max-age=#{15.minutes}"
  respond_with(@tags)
end