prevent searching with spaces

This commit is contained in:
Maxwell Salzberg 2011-01-17 13:48:52 -08:00
parent 72785a69cb
commit 254c411bd9

View file

@ -38,7 +38,7 @@ class Person < ActiveRecord::Base
scope :searchable, joins(:profile).where(:profiles => {:searchable => true})
def self.search(query)
return [] if query.to_s.empty?
return [] if query.to_s.blank?
where_clause = <<-SQL
profiles.first_name LIKE ? OR