Class: PollAnswersController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/poll_answers_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

post /poll_answers



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

def create
  @entity = PollAnswer.new(creation_parameters)
  if @entity.save
    redirect_to admin_poll_answer_path(@entity.id)
  else
    render :new, status: :bad_request
  end
end

#destroyObject

delete /poll_answers/:id



28
29
30
31
32
33
# File 'app/controllers/poll_answers_controller.rb', line 28

def destroy
  if @entity.destroy
    flash[:notice] = t('poll_answers.destroy.success')
  end
  redirect_to(admin_poll_path(@entity.id))
end

#editObject

get /poll_answers/:id/edit



15
16
# File 'app/controllers/poll_answers_controller.rb', line 15

def edit
end

#updateObject

patch /poll_answers/:id



19
20
21
22
23
24
25
# File 'app/controllers/poll_answers_controller.rb', line 19

def update
  if @entity.update(entity_parameters)
    redirect_to admin_poll_answer_path(@entity.id), notice: t('poll_answers.update.success')
  else
    render :edit, status: :bad_request
  end
end