Class: ProduceTypesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/produce_types_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /produce_types POST /produce_types.json



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'app/controllers/produce_types_controller.rb', line 40

def create
  @produce_type = ProduceType.new(produce_type_params)

  respond_to do |format|
    if @produce_type.save
      format.html { redirect_to @produce_type, notice: t('controller.successfully_created', model: t('activerecord.models.produce_type')) }
      format.json { render json: @produce_type, status: :created, location: @produce_type }
    else
      format.html { render action: "new" }
      format.json { render json: @produce_type.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /produce_types/1 DELETE /produce_types/1.json



75
76
77
78
79
80
81
82
# File 'app/controllers/produce_types_controller.rb', line 75

def destroy
  @produce_type.destroy

  respond_to do |format|
    format.html { redirect_to produce_types_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.produce_type')) }
    format.json { head :no_content }
  end
end

#editObject

GET /produce_types/1/edit



35
36
# File 'app/controllers/produce_types_controller.rb', line 35

def edit
end

#indexObject

GET /produce_types GET /produce_types.json



5
6
7
8
9
10
11
12
# File 'app/controllers/produce_types_controller.rb', line 5

def index
  @produce_types = ProduceType.all

  respond_to do |format|
    format.html # index.html.erb
    format.json { render json: @produce_types }
  end
end

#newObject

GET /produce_types/new GET /produce_types/new.json



25
26
27
28
29
30
31
32
# File 'app/controllers/produce_types_controller.rb', line 25

def new
  @produce_type = ProduceType.new

  respond_to do |format|
    format.html # new.html.erb
    format.json { render json: @produce_type }
  end
end

#showObject

GET /produce_types/1 GET /produce_types/1.json



16
17
18
19
20
21
# File 'app/controllers/produce_types_controller.rb', line 16

def show
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @produce_type }
  end
end

#updateObject

PUT /produce_types/1 PUT /produce_types/1.json



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'app/controllers/produce_types_controller.rb', line 56

def update
  if params[:move]
    move_position(@produce_type, params[:move])
    return
  end

  respond_to do |format|
    if @produce_type.update_attributes(produce_type_params)
      format.html { redirect_to @produce_type, notice: t('controller.successfully_updated', model: t('activerecord.models.produce_type')) }
      format.json { head :no_content }
    else
      format.html { render action: "edit" }
      format.json { render json: @produce_type.errors, status: :unprocessable_entity }
    end
  end
end