foodsoft/app/controllers/admin/ordergroups_controller.rb

24 lines
714 B
Ruby
Raw Normal View History

2012-07-31 18:48:41 +02:00
# encoding: utf-8
class Admin::OrdergroupsController < Admin::BaseController
2011-06-10 01:36:04 +02:00
inherit_resources
def index
@ordergroups = Ordergroup.undeleted.order('name ASC')
2011-06-10 01:36:04 +02:00
# if somebody uses the search field:
unless params[:query].blank?
@ordergroups = @ordergroups.where('name LIKE ?', "%#{params[:query]}%")
2011-06-10 01:36:04 +02:00
end
@ordergroups = @ordergroups.page(params[:page]).per(@per_page)
end
def destroy
@ordergroup = Ordergroup.find(params[:id])
@ordergroup.mark_as_deleted
redirect_to admin_ordergroups_url, :notice => "Bestellgruppe wurde gelöscht"
rescue => error
redirect_to admin_ordergroups_url, :alert => "Bestellgruppe konnte nicht gelöscht werden: #{error}"
end
end