Class: Api::V1::FallbackController
- Inherits:
-
BaseController
- Object
- ActionController::API
- BaseController
- Api::V1::FallbackController
- Defined in:
- app/controllers/api/v1/fallback_controller.rb
Overview
API fallback controller for handling unmatched routes on the API subdomain.
This ensures that requests to api.* that don't match any defined route
return proper JSON responses without invoking ApplicationController's
session handling, guest user creation, or HTML rendering.
All API requests should stay within ActionController::API inheritance.
Instance Method Summary collapse
-
#bad_request ⇒ Object
Handle malformed requests (JSON parse errors, bad params).
-
#not_found ⇒ Object
Catch-all for unmatched routes.
Methods inherited from BaseController
#catalog_for_request, #error!, #locale_for_request, #logger, #render_bad_request_response, #render_internal_server_error, #render_not_found_response, #render_result, #render_unprocessable_entity_response, #set_locale, #store_for_request, #underscore_params
Instance Method Details
#bad_request ⇒ Object
Handle malformed requests (JSON parse errors, bad params)
17 18 19 |
# File 'app/controllers/api/v1/fallback_controller.rb', line 17 def bad_request render json: { error: 'Bad Request' }, status: :bad_request end |
#not_found ⇒ Object
Catch-all for unmatched routes
12 13 14 |
# File 'app/controllers/api/v1/fallback_controller.rb', line 12 def not_found render json: { error: 'Not Found' }, status: :not_found end |