foodsoft/app/controllers/admin/workgroups_controller.rb

20 lines
650 B
Ruby
Raw Permalink Normal View History

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]}%") unless params[:query].blank?
@workgroups = @workgroups.page(params[:page]).per(@per_page)
end
2011-06-10 13:22:15 +02:00
def destroy
@workgroup = Workgroup.find(params[:id])
@workgroup.destroy
2013-06-06 02:13:40 +02:00
redirect_to admin_workgroups_url, notice: t('admin.workgroups.destroy.notice')
2011-06-10 13:22:15 +02:00
rescue => error
redirect_to admin_workgroups_url, alert: t('admin.workgroups.destroy.error', error: error.message)
end
end