class SearchController < ApplicationController def results if params[:q] @search = params[:q] @backlogs = Backlog.find(:all, :conditions => ["lower(name) LIKE ?", "%#{@search.downcase}%"]) @tasks = Task.find(:all, :conditions => ["lower(description) LIKE ? OR lower(notes) LIKE ?", "%#{@search.downcase}%", "%#{@search.downcase}%"]) @work_accounts = WorkAccount.find(:all, :conditions => ["lower(name) LIKE ?", "%#{@search.downcase}%"]) @works = Work.find(:all, :conditions => ["lower(description) LIKE ? OR lower(notes) LIKE ?", "%#{@search.downcase}%", "%#{@search.downcase}%"]) else @backlogs = [] @tasks = [] @work_accounts = [] @works = [] end end end