Class: ModelExplorer::ModelsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ModelExplorer::ModelsController
- Defined in:
- app/controllers/model_explorer/models_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
5 6 7 |
# File 'app/controllers/model_explorer/models_controller.rb', line 5 def index @models = ModelExplorer.models.map(&:name).sort end |
#show ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/model_explorer/models_controller.rb', line 9 def show model_name = params[:id] ensure_valid_model_name(model_name) render json: ModelSerializer.new( model: model_name.constantize, macro: params[:macro], parent: params[:parent] ).to_json rescue => error render_bad_request(error) end |