foodsoft/app/controllers/foodcoop/ordergroups_controller.rb

21 lines
578 B
Ruby
Raw Permalink Normal View History

class Foodcoop::OrdergroupsController < ApplicationController
def index
@ordergroups = Ordergroup.undeleted.sort_by_param(params["sort"])
unless params[:name].blank? # Search by name
@ordergroups = @ordergroups.where('name LIKE ?', "%#{params[:name]}%")
end
if params[:only_active] # Select only active groups
2021-03-17 13:12:13 +01:00
@ordergroups = @ordergroups.active
end
@ordergroups = @ordergroups.page(params[:page]).per(@per_page)
respond_to do |format|
format.html # index.html.erb
2011-05-18 11:47:00 +02:00
format.js { render :layout => false }
end
end
end