Class: ModelInfo::Api::V1::ModelsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- ModelInfo::Api::V1::ModelsController
- Defined in:
- app/controllers/model_info/api/v1/models_controller.rb
Overview
:nodoc
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
-
#index ⇒ Object
GET /models or /models.json.
-
#show ⇒ Object
GET /comapnies/new.
- #update ⇒ Object
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 |
# File 'app/controllers/model_info/api/v1/models_controller.rb', line 18 def create model_object = model.new(permit_params) if model_object.save render json: { status: :created } end end |
#destroy ⇒ Object
29 30 31 |
# File 'app/controllers/model_info/api/v1/models_controller.rb', line 29 def destroy @model_object.destroy end |
#index ⇒ Object
GET /models or /models.json
9 10 11 |
# File 'app/controllers/model_info/api/v1/models_controller.rb', line 9 def index render json: model.all end |
#show ⇒ Object
GET /comapnies/new
14 15 16 |
# File 'app/controllers/model_info/api/v1/models_controller.rb', line 14 def show render json: @model_object end |
#update ⇒ Object
25 26 27 |
# File 'app/controllers/model_info/api/v1/models_controller.rb', line 25 def update @model_object.update(permit_params) end |