Sha256: c403f4821b3afdf3f33292399d815ee13b0802194fc2b4d14bb3307ea27b9e8e

Contents?: true

Size: 594 Bytes

Versions: 2

Compression:

Stored size: 594 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
backlog-0.37.2 app/controllers/search_controller.rb
backlog-0.37.1 app/controllers/search_controller.rb