Class: Admin::OrdergroupsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/ordergroups_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject


16
17
18
19
20
21
22
# File 'app/controllers/admin/ordergroups_controller.rb', line 16

def destroy
  @ordergroup = Ordergroup.find(params[:id])
  @ordergroup.mark_as_deleted
  redirect_to admin_ordergroups_url, notice: t('admin.ordergroups.destroy.notice')
rescue => error
  redirect_to admin_ordergroups_url, alert: t('admin.ordergroups.destroy.error')
end

#indexObject


5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/admin/ordergroups_controller.rb', line 5

def index
  @ordergroups = Ordergroup.undeleted.order('name ASC')

  # if somebody uses the search field:
  unless params[:query].blank?
    @ordergroups = @ordergroups.where('name LIKE ?', "%#{params[:query]}%")
  end

  @ordergroups = @ordergroups.page(params[:page]).per(@per_page)
end