Class: Databaseformalizer::EntityDefsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Databaseformalizer::EntityDefsController
- Defined in:
- app/controllers/databaseformalizer/entity_defs_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /entity_defs POST /entity_defs.json.
-
#destroy ⇒ Object
DELETE /entity_defs/1 DELETE /entity_defs/1.json.
-
#edit ⇒ Object
GET /entity_defs/1/edit.
-
#index ⇒ Object
GET /entity_defs GET /entity_defs.json.
-
#new ⇒ Object
GET /entity_defs/new GET /entity_defs/new.json.
-
#show ⇒ Object
GET /entity_defs/1 GET /entity_defs/1.json.
-
#update ⇒ Object
PUT /entity_defs/1 PUT /entity_defs/1.json.
Instance Method Details
#create ⇒ Object
POST /entity_defs POST /entity_defs.json
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/databaseformalizer/entity_defs_controller.rb', line 44 def create @entity_def = EntityDef.new(params[:databaseformalizer_entity_def]) if @entity_def.label == "" @entity_def.label = @entity_def.entity_def_name end respond_to do |format| if @entity_def.save format.html { redirect_to @entity_def, notice: 'Entity def was successfully created.'} format.json { render json: @entity_def, status: :created, location: @entity_def } else format.html { render action: "new" } format.json { render json: @entity_def.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /entity_defs/1 DELETE /entity_defs/1.json
80 81 82 83 84 85 86 87 88 |
# File 'app/controllers/databaseformalizer/entity_defs_controller.rb', line 80 def destroy @entity_def = EntityDef.find(params[:id]) @entity_def.destroy respond_to do |format| format.html { redirect_to databaseformalizer_entity_defs_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /entity_defs/1/edit
38 39 40 |
# File 'app/controllers/databaseformalizer/entity_defs_controller.rb', line 38 def edit @entity_def = EntityDef.find(params[:id]) end |
#index ⇒ Object
GET /entity_defs GET /entity_defs.json
5 6 7 8 9 10 11 12 13 |
# File 'app/controllers/databaseformalizer/entity_defs_controller.rb', line 5 def index @entity_defs = EntityDef.all EntityDefsHelper.setMetaModelGraph("public/UMLmetaModel.png") respond_to do |format| format.html # index.html.erb format.json { render json: @entity_defs } end end |
#new ⇒ Object
GET /entity_defs/new GET /entity_defs/new.json
28 29 30 31 32 33 34 35 |
# File 'app/controllers/databaseformalizer/entity_defs_controller.rb', line 28 def new @entity_def = EntityDef.new respond_to do |format| format.html # new.html.erb format.json { render json: @entity_def } end end |
#show ⇒ Object
GET /entity_defs/1 GET /entity_defs/1.json
17 18 19 20 21 22 23 24 |
# File 'app/controllers/databaseformalizer/entity_defs_controller.rb', line 17 def show @entity_def = EntityDef.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @entity_def } end end |
#update ⇒ Object
PUT /entity_defs/1 PUT /entity_defs/1.json
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'app/controllers/databaseformalizer/entity_defs_controller.rb', line 62 def update @entity_def = EntityDef.find(params[:id]) if params[:databaseformalizer_entity_def][:attrDef_ids] == nil @entity_def.attrDefs.clear end respond_to do |format| if @entity_def.update_attributes(params[:databaseformalizer_entity_def]) format.html { redirect_to @entity_def, notice: 'Entity def was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @entity_def.errors, status: :unprocessable_entity } end end end |