Skip to content

Commit

Permalink
Added destroy action for multiple choice questions
Browse files Browse the repository at this point in the history
  • Loading branch information
sdflem committed Oct 9, 2018
1 parent de55e42 commit 36eb7f1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/controllers/multiple_choice_questions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,10 @@ def update
render :edit
end
end

def destroy
@multiple_choice_question = MultipleChoiceQuestion.find(params[:id])
@multiple_choice_question.destroy
redirect_to multiple_choice_questions_url, notice: 'Multiple choice question was successfully destroyed.'
end
end
1 change: 1 addition & 0 deletions app/views/multiple_choice_questions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<td>
<%= link_to 'Show', multiple_choice_question_path(question) %>
<%= link_to 'Edit', edit_multiple_choice_question_path(question) %>
<%= link_to 'Destroy', multiple_choice_question_path(question), method: :delete %>
</td>
</tr>
<% end %>
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
get 'multiple_choice_questions/:id', to: 'multiple_choice_questions#show', as: 'multiple_choice_question'
patch 'multiple_choice_questions/:id', to: 'multiple_choice_questions#update'
put 'multiple_choice_questions/:id', to: 'multiple_choice_questions#update'
delete 'multiple_choice_questions/:id', to: 'multiple_choice_questions#destroy'

# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end

0 comments on commit 36eb7f1

Please sign in to comment.