foodsoft/plugins/messages/app/controllers/admin/messagegroups_controller.rb
Philipp Rothmann fb2b4d8a8a chore: rubocop
chore: fix api test conventions

chore: rubocop -A spec/

chore: more rubocop -A

fix failing test

rubocop fixes

removes helper methods that are in my opinion dead code

more rubocop fixes

rubocop -a --auto-gen-config
2023-06-09 17:35:05 +02:00

19 lines
696 B
Ruby

class Admin::MessagegroupsController < Admin::BaseController
inherit_resources
def index
@messagegroups = Messagegroup.order('name ASC')
# if somebody uses the search field:
@messagegroups = @messagegroups.where('name LIKE ?', "%#{params[:query]}%") if params[:query].present?
@messagegroups = @messagegroups.page(params[:page]).per(@per_page)
end
def destroy
@messagegroup = Messagegroup.find(params[:id])
@messagegroup.destroy
redirect_to admin_messagegroups_url, notice: t('admin.messagegroups.destroy.notice')
rescue StandardError => e
redirect_to admin_messagegroups_url, alert: t('admin.messagegroups.destroy.error', error: e.message)
end
end