Member search now includes the attribute 'nick'. Closes #18

This commit is contained in:
Benjamin Meichsner 2009-07-20 19:29:24 +02:00
parent d2efe64343
commit ecc1176020

View file

@ -24,7 +24,10 @@ class FoodcoopController < ApplicationController
end end
# if somebody uses the search field: # if somebody uses the search field:
conditions = ["first_name LIKE ? OR last_name LIKE ?", "%#{params[:query]}%", "%#{params[:query]}%"] unless params[:query].blank? unless params[:query].blank?
conditions = ["first_name LIKE ? OR last_name LIKE ? OR nick LIKE ?",
"%#{params[:query]}%", "%#{params[:query]}%", "%#{params[:query]}%"]
end
@total = User.count(:conditions => conditions) @total = User.count(:conditions => conditions)
@users = User.paginate(:page => params[:page], :per_page => @per_page, :conditions => conditions, :order => "nick", :include => :groups) @users = User.paginate(:page => params[:page], :per_page => @per_page, :conditions => conditions, :order => "nick", :include => :groups)