[refs #270] fixed users filtration
This commit is contained in:
parent
a562219706
commit
bf1340939b
|
@ -61,10 +61,10 @@ class Admin::UsersController < ApplicationController
|
|||
if !params[:sSearch].blank? && search = "%#{params[:sSearch]}%"
|
||||
@users = @users.where('users.name ILIKE ? or users.uname ILIKE ? or users.email ILIKE ?', search, search, search)
|
||||
end
|
||||
@filter = params[:filter] || 'all'
|
||||
@users = @users.send(@filter) if ['real', 'admin', 'banned'].include? @filter
|
||||
@total_user = @users.count
|
||||
@users = @users.order(order)
|
||||
@filter = params[:filter] || 'all'
|
||||
@user.send(@filter.to_sym) if ['real', 'admin', 'banned'].include? @filter
|
||||
|
||||
render :partial =>'users_ajax', :layout => false
|
||||
end
|
||||
|
|
|
@ -52,8 +52,8 @@ class User < ActiveRecord::Base
|
|||
scope :search_order, order("CHAR_LENGTH(uname) ASC")
|
||||
scope :search, lambda {|q| where("uname ILIKE ?", "%#{q}%")}
|
||||
scope :banned, where('users.locked_at is not null')
|
||||
scope :admin, where(:role => 'admin')
|
||||
scope :real, where(:role => ['', nil])
|
||||
scope :admin, where(:role => 'admin').where(:locked_at => nil)
|
||||
scope :real, where(:role => ['', nil]).where(:locked_at => nil)
|
||||
|
||||
after_create lambda { self.create_notifier }
|
||||
|
||||
|
|
Loading…
Reference in New Issue