Class: KmzModelsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/kmz_models_controller.rb

Overview

typed: false

Instance Method Summary collapse

Methods inherited from ApplicationController

#gdpr_compliance

Instance Method Details

#createObject

POST /kmz_models POST /kmz_models.json



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/controllers/kmz_models_controller.rb', line 32

def create
  @kmz_model = KmzModel.new(kmz_model_params)

  respond_to do |format|
    if @kmz_model.save
      format.html { redirect_to @kmz_model, notice: 'Kmz model was successfully created.' }
      format.json { render :show, status: :created, location: @kmz_model }
    else
      format.html { render :new }
      format.json { render json: @kmz_model.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /kmz_models/1 DELETE /kmz_models/1.json



62
63
64
65
66
67
68
# File 'app/controllers/kmz_models_controller.rb', line 62

def destroy
  @kmz_model.destroy
  respond_to do |format|
    format.html { redirect_to kmz_models_url, notice: 'Kmz model was successfully destroyed.' }
    format.json { head :no_content }
  end
end

#editObject

GET /kmz_models/1/edit



27
28
# File 'app/controllers/kmz_models_controller.rb', line 27

def edit
end

#indexObject

GET /kmz_models GET /kmz_models.json



7
8
9
# File 'app/controllers/kmz_models_controller.rb', line 7

def index
  @kmz_models = KmzModel.all
end

#newObject

GET /kmz_models/new



22
23
24
# File 'app/controllers/kmz_models_controller.rb', line 22

def new
  @kmz_model = KmzModel.new
end

#showObject

GET /kmz_models/1 GET /kmz_models/1.json



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

def show
  respond_to do |format|
    format.kmz do
      send_file EziiOsPath.new(@kmz_model.global_path).file_system_path
    end
  end
end

#updateObject

PATCH/PUT /kmz_models/1 PATCH/PUT /kmz_models/1.json



48
49
50
51
52
53
54
55
56
57
58
# File 'app/controllers/kmz_models_controller.rb', line 48

def update
  respond_to do |format|
    if @kmz_model.update(kmz_model_params)
      format.html { redirect_to @kmz_model, notice: 'Kmz model was successfully updated.' }
      format.json { render :show, status: :ok, location: @kmz_model }
    else
      format.html { render :edit }
      format.json { render json: @kmz_model.errors, status: :unprocessable_entity }
    end
  end
end