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
606 B
Ruby
19 lines
606 B
Ruby
class Admin::WorkgroupsController < Admin::BaseController
|
|
inherit_resources
|
|
|
|
def index
|
|
@workgroups = Workgroup.order('name ASC')
|
|
# if somebody uses the search field:
|
|
@workgroups = @workgroups.where('name LIKE ?', "%#{params[:query]}%") if params[:query].present?
|
|
|
|
@workgroups = @workgroups.page(params[:page]).per(@per_page)
|
|
end
|
|
|
|
def destroy
|
|
@workgroup = Workgroup.find(params[:id])
|
|
@workgroup.destroy
|
|
redirect_to admin_workgroups_url, notice: t('.notice')
|
|
rescue StandardError => e
|
|
redirect_to admin_workgroups_url, alert: t('.error', error: e.message)
|
|
end
|
|
end
|