add trashable to question

This commit is contained in:
João Geonizeli
2022-08-05 23:40:03 +00:00
parent 9917441fe4
commit 5005d7ca68
6 changed files with 36 additions and 2 deletions

View File

@@ -1,6 +1,30 @@
ActiveAdmin.register Question do
permit_params :authorship, :authorship_year, :check_type, :difficulty, :status, :subject_id
scope :all, default: true
scope :trashed
controller do
def show
@question = Question.unscoped.find_by!(permitted_params[:question])
end
def edit
@question = Question.unscoped.find_by!(permitted_params[:question])
end
def destroy
@question = Question.unscoped.find(permitted_params[:id])
if @question.deleted_at
redirect_to admin_questions_path, notice: t('active_admin.question.already_destroyed')
else
@question.destroy
redirect_to admin_questions_path, notice: t('active_admin.question.succesfully_destroyed')
end
end
end
index do
selectable_column
id_column