add trashable to question
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user