Class: AgentsController
- Inherits:
-
AdminController
- Object
- ApplicationController
- AdminController
- AgentsController
- Defined in:
- app/controllers/agents_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
post /agents.
-
#destroy ⇒ Object
delete /agents/:id.
-
#edit ⇒ Object
get /agents/:id/edit.
-
#new ⇒ Object
get /agents/new.
-
#show ⇒ Object
get /agents/:id.
-
#update ⇒ Object
patch /agents/:id.
Instance Method Details
#create ⇒ Object
post /agents
11 12 13 14 15 16 17 18 |
# File 'app/controllers/agents_controller.rb', line 11 def create @entity = Agent.new entity_parameters if @entity.save form_processed_ok(admin_agent_path(id: @entity.id)) else form_processed_with_error(:new) end end |
#destroy ⇒ Object
delete /agents/:id
38 39 40 41 42 43 |
# File 'app/controllers/agents_controller.rb', line 38 def destroy if @entity.update! deleted: true flash[:notice] = t('agents.destroy.success') end redirect_to admin_agents_path end |
#edit ⇒ Object
get /agents/:id/edit
25 26 |
# File 'app/controllers/agents_controller.rb', line 25 def edit end |
#new ⇒ Object
get /agents/new
6 7 8 |
# File 'app/controllers/agents_controller.rb', line 6 def new @entity = Agent.new end |
#show ⇒ Object
get /agents/:id
21 22 |
# File 'app/controllers/agents_controller.rb', line 21 def show end |
#update ⇒ Object
patch /agents/:id
29 30 31 32 33 34 35 |
# File 'app/controllers/agents_controller.rb', line 29 def update if @entity.update entity_parameters form_processed_ok(admin_agent_path(id: @entity.id)) else form_processed_with_error(:edit) end end |