foodsoft/app/controllers/admin/users_controller.rb

20 lines
596 B
Ruby
Raw Normal View History

class Admin::UsersController < Admin::BaseController
2011-06-09 22:03:27 +02:00
inherit_resources
def index
2011-06-09 22:03:27 +02:00
@users = User.order(:nick.asc)
# if somebody uses the search field:
unless params[:query].blank?
@users = @users.where(({:first_name.matches => "%#{params[:query]}%"}) | ({:last_name.matches => "%#{params[:query]}%"}) | ({:nick.matches => "%#{params[:query]}%"}))
end
@users = @users.paginate(:page => params[:page], :per_page => @per_page)
respond_to do |format|
2011-06-09 22:03:27 +02:00
format.html # index.html.haml
format.js { render :layout => false } # index.js.erb
end
end
end