Class: Spree::Api::V3::Admin::CountriesController

Inherits:
ResourceController show all
Defined in:
app/controllers/spree/api/v3/admin/countries_controller.rb

Constant Summary

Constants included from ScopedAuthorization

ScopedAuthorization::READ_ACTIONS

Constants inherited from BaseController

BaseController::RATE_LIMIT_RESPONSE

Constants included from Idempotent

Idempotent::IDEMPOTENCY_HEADER, Idempotent::IDEMPOTENCY_TTL, Idempotent::MAX_KEY_LENGTH, Idempotent::MUTATING_METHODS

Constants included from ErrorHandler

ErrorHandler::ERROR_CODES

Constants included from JwtAuthentication

JwtAuthentication::JWT_AUDIENCE_ADMIN, JwtAuthentication::JWT_AUDIENCE_STORE, JwtAuthentication::JWT_ISSUER, JwtAuthentication::USER_TYPE_ADMIN, JwtAuthentication::USER_TYPE_CUSTOMER

Instance Method Summary collapse

Methods inherited from ResourceController

#create, #destroy, #show, #update

Methods included from Spree::Api::V3::ApiKeyAuthentication

#authenticate_api_key!, #authenticate_secret_key!

Methods included from JwtAuthentication

#authenticate_user, #require_authentication!

Instance Method Details

#indexObject

Override base index to skip pagination — there are ~250 countries and address-form dropdowns need them all at once. Pagy’s global max_limit (100) prevents using the paginated path for this.



11
12
13
14
15
# File 'app/controllers/spree/api/v3/admin/countries_controller.rb', line 11

def index
  authorize!(:read, model_class)
  @collection = scope
  render json: { data: serialize_collection(@collection), meta: { count: @collection.size } }
end