Class: CandidatesController
- Inherits:
-
AdminController
- Object
- AdminController
- CandidatesController
- Defined in:
- app/controllers/candidates_controller.rb
Overview
Managing candidates
Instance Method Summary collapse
-
#check ⇒ Object
post /candidates/check.
-
#create ⇒ Object
post /candidates.
-
#destroy ⇒ Object
delete /candidates/:id.
-
#edit ⇒ Object
get /candidates/:id/edit.
-
#new ⇒ Object
get /candidates/new.
-
#update ⇒ Object
patch /candidates/:id.
Instance Method Details
#check ⇒ Object
post /candidates/check
8 9 10 11 12 |
# File 'app/controllers/candidates_controller.rb', line 8 def check @entity = Candidate.instance_for_check(params[:entity_id], entity_parameters) render 'shared/forms/check' end |
#create ⇒ Object
post /candidates
20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/candidates_controller.rb', line 20 def create @entity = Candidate.new(creation_parameters) if @entity.save NetworkCandidateSyncJob.perform_later(@entity.id) form_processed_ok(admin_candidate_path(id: @entity.id)) else form_processed_with_error(:new) end end |
#destroy ⇒ Object
delete /candidates/:id
45 46 47 48 49 |
# File 'app/controllers/candidates_controller.rb', line 45 def destroy flash[:notice] = t('candidates.destroy.success') if @entity.destroy redirect_to(candidates_admin_campaign_path(id: @entity.campaign_id)) end |
#edit ⇒ Object
get /candidates/:id/edit
31 32 |
# File 'app/controllers/candidates_controller.rb', line 31 def edit end |
#new ⇒ Object
get /candidates/new
15 16 17 |
# File 'app/controllers/candidates_controller.rb', line 15 def new @entity = Candidate.new end |
#update ⇒ Object
patch /candidates/:id
35 36 37 38 39 40 41 42 |
# File 'app/controllers/candidates_controller.rb', line 35 def update if @entity.update(entity_parameters) NetworkCandidateSyncJob.perform_later(@entity.id, true) form_processed_ok(admin_candidate_path(id: @entity.id)) else form_processed_with_error(:edit) end end |