Class: Studio::ModelsController

Inherits:
ApplicationController
  • Object
show all
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

Instance Method Details

#randomObject

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

#showObject

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