Class: Neo4j::MetaModel::Meta::ModelsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Neo4j::MetaModel::Meta::ModelsController
- Defined in:
- app/controllers/neo4j/meta_model/meta/models_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #hierarchy ⇒ Object
- #index ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/controllers/neo4j/meta_model/meta/models_controller.rb', line 32 def create model = Model.create(model_params) create_models render json: model end |
#destroy ⇒ Object
51 52 53 54 55 56 57 |
# File 'app/controllers/neo4j/meta_model/meta/models_controller.rb', line 51 def destroy @model.destroy create_models render json: nil end |
#edit ⇒ Object
28 29 30 |
# File 'app/controllers/neo4j/meta_model/meta/models_controller.rb', line 28 def edit @models = Model.all.order(:name) end |
#hierarchy ⇒ Object
14 15 16 17 18 |
# File 'app/controllers/neo4j/meta_model/meta/models_controller.rb', line 14 def hierarchy respond_to do |format| format.json { render json: Model.all.hierarchically } end end |
#index ⇒ Object
7 8 9 10 11 12 |
# File 'app/controllers/neo4j/meta_model/meta/models_controller.rb', line 7 def index respond_to do |format| format.html { @hierarchy = Model.all.hierarchically } format.json { render json: Model.all } end end |
#show ⇒ Object
20 21 22 23 24 25 26 |
# File 'app/controllers/neo4j/meta_model/meta/models_controller.rb', line 20 def show respond_to do |format| format.json do render json: @model end end end |
#update ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/neo4j/meta_model/meta/models_controller.rb', line 40 def update model_params.each do |key, value| @model.send("#{key}=", value) end @model.save create_models render json: @model end |