fb2b4d8a8a
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
19 lines
696 B
Ruby
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
|