Class: CodesController
- Inherits:
-
AdminController
- Object
- ApplicationController
- AdminController
- CodesController
- Defined in:
- app/controllers/codes_controller.rb
Overview
Managing user codes
Instance Method Summary collapse
-
#create ⇒ Object
post /codes.
-
#destroy ⇒ Object
delete /codes/:id.
-
#edit ⇒ Object
get /codes/:id/edit.
-
#new ⇒ Object
get /codes/new.
-
#update ⇒ Object
patch /codes/:id.
Instance Method Details
#create ⇒ Object
post /codes
13 14 15 16 17 18 19 20 |
# File 'app/controllers/codes_controller.rb', line 13 def create @entity = Code.new(creation_parameters) if @entity.save form_processed_ok(admin_code_path(id: @entity.id)) else form_processed_with_error(:new) end end |
#destroy ⇒ Object
delete /codes/:id
37 38 39 40 41 |
# File 'app/controllers/codes_controller.rb', line 37 def destroy flash[:notice] = t('codes.destroy.success') if @entity.destroy redirect_to admin_codes_path end |
#edit ⇒ Object
get /codes/:id/edit
23 24 |
# File 'app/controllers/codes_controller.rb', line 23 def edit end |
#new ⇒ Object
get /codes/new
8 9 10 |
# File 'app/controllers/codes_controller.rb', line 8 def new @entity = Code.new end |
#update ⇒ Object
patch /codes/:id
27 28 29 30 31 32 33 34 |
# File 'app/controllers/codes_controller.rb', line 27 def update if @entity.update(entity_parameters) flash[:notice] = t('codes.update.success') form_processed_ok(admin_code_path(id: @entity.id)) else form_processed_with_error(:edit) end end |