Class: Trade::Admin::ProducesController
- Inherits:
-
BaseController
- Object
- BaseController
- Trade::Admin::ProducesController
- Defined in:
- app/controllers/trade/admin/produces_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#destroy ⇒ Object
DELETE /produces/1 DELETE /produces/1.json.
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
-
#update ⇒ Object
PATCH/PUT /produces/1 PATCH/PUT /produces/1.json.
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/trade/admin/produces_controller.rb', line 18 def create @produce = Produce.new(produce_params) respond_to do |format| if @produce.save format.html { redirect_to @produce } format.json { render :show, status: :created, location: @produce } else format.html { render :new } format.json { render json: @produce.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /produces/1 DELETE /produces/1.json
48 49 50 51 52 53 54 |
# File 'app/controllers/trade/admin/produces_controller.rb', line 48 def destroy @produce.destroy respond_to do |format| format.html { redirect_to produces_url } format.json { head :no_content } end end |
#edit ⇒ Object
15 16 |
# File 'app/controllers/trade/admin/produces_controller.rb', line 15 def edit end |
#index ⇒ Object
4 5 6 |
# File 'app/controllers/trade/admin/produces_controller.rb', line 4 def index @produces = Produce.all end |
#new ⇒ Object
11 12 13 |
# File 'app/controllers/trade/admin/produces_controller.rb', line 11 def new @produce = Produce.new end |
#show ⇒ Object
8 9 |
# File 'app/controllers/trade/admin/produces_controller.rb', line 8 def show end |
#update ⇒ Object
PATCH/PUT /produces/1 PATCH/PUT /produces/1.json
34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/trade/admin/produces_controller.rb', line 34 def update respond_to do |format| if @produce.update(produce_params) format.html { redirect_to @produce } format.json { render :show, status: :ok, location: @produce } else format.html { render :edit } format.json { render json: @produce.errors, status: :unprocessable_entity } end end end |