Class: Studio::ModelsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Studio::ModelsController
- Defined in:
- app/controllers/studio/models_controller.rb
Overview
Serves the model-page protocol (see Studio::ModelPage). Admin-only: raw record JSON can carry internal fields, so this is an operator/debug surface, not a public one. require_authentication is inherited from the host app's ApplicationController (Studio::ErrorHandling); require_admin gates on top.
Instance Method Summary collapse
-
#random ⇒ Object
GET /models/:model/random — bounce to a random record's page (fresh sample).
-
#show ⇒ Object
GET /models/:model/:id — one record as JSON + a copy/paste console command.
Instance Method Details
#random ⇒ Object
GET /models/:model/random — bounce to a random record's page (fresh sample).
18 19 20 21 22 23 |
# File 'app/controllers/studio/models_controller.rb', line 18 def random record = @page.random_record return head(:not_found) unless record redirect_to studio_model_path(@page.model_key, @page.identifier_for(record)) end |
#show ⇒ Object
GET /models/:model/:id — one record as JSON + a copy/paste console command.
13 14 15 |
# File 'app/controllers/studio/models_controller.rb', line 13 def show head :not_found unless @page.record end |