From ecc1176020a2c33500c9bcdc6795d3b04f79377f Mon Sep 17 00:00:00 2001 From: Benjamin Meichsner Date: Mon, 20 Jul 2009 19:29:24 +0200 Subject: [PATCH] Member search now includes the attribute 'nick'. Closes #18 --- app/controllers/foodcoop_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/foodcoop_controller.rb b/app/controllers/foodcoop_controller.rb index 79ea1b1f..18097da4 100644 --- a/app/controllers/foodcoop_controller.rb +++ b/app/controllers/foodcoop_controller.rb @@ -24,7 +24,10 @@ class FoodcoopController < ApplicationController end # 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) @users = User.paginate(:page => params[:page], :per_page => @per_page, :conditions => conditions, :order => "nick", :include => :groups)