Class: Neo4j::MetaModel::ModelsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/neo4j/meta_model/models_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



37
38
39
40
41
# File 'app/controllers/neo4j/meta_model/models_controller.rb', line 37

def create
  record = @model.create(params[:data])

  redirect_to action: :show, id: record.id
end

#destroyObject



43
44
45
46
47
# File 'app/controllers/neo4j/meta_model/models_controller.rb', line 43

def destroy
  @record.destroy

  redirect_to action: :index, model: params[:model]
end

#editObject



24
25
# File 'app/controllers/neo4j/meta_model/models_controller.rb', line 24

def edit
end

#indexObject



13
14
15
16
17
18
19
# File 'app/controllers/neo4j/meta_model/models_controller.rb', line 13

def index
  @records = @model.all.to_a
  respond_to do |format|
    format.html
    format.json { render json: @records, root: :records }
  end
end

#meta_indexObject



9
10
11
# File 'app/controllers/neo4j/meta_model/models_controller.rb', line 9

def meta_index
  @hierarchy = Model.order(:class_name).hierarchically
end

#newObject



33
34
35
# File 'app/controllers/neo4j/meta_model/models_controller.rb', line 33

def new
  @record = @model.new
end

#showObject



21
22
# File 'app/controllers/neo4j/meta_model/models_controller.rb', line 21

def show
end

#updateObject



27
28
29
30
31
# File 'app/controllers/neo4j/meta_model/models_controller.rb', line 27

def update
  @record.update_attributes(params[:data])

  redirect_to action: :show
end