Looks like sqlite3 doesn't care, but postgresql does not.

Postgresql evidently has an 'ILIKE' operator that is a case
insensitive 'LIKE' operator.

Now I just have to figure out how to test and submit a patch to
find_by_search that would set the text for the like operator:

in find_by_search:

      search_targets.build_hash do |search_target|
        conditions = []
        parameters = []
+       like_operator = 'like'
+       if ActiveRecord::Base.connection.instance_variable_get
("@config")[:adapter] == 'postgresql'
+           like_operator = 'ilike'
+       end
        query_words.each do |word|
-         column_queries = search_target.search_columns.map { |column|
"#{column} like ?" }
+         column_queries = search_target.search_columns.map { |column|
"#{column} #{like_operator} ?" }
          conditions << "(" + column_queries.join(" or ") + ")"
          parameters.concat(["%#{word}%"] * column_queries.length)
        end
        conditions = conditions.join(" and ")

        results = search_target.find(:all, :conditions => [conditions,
*parameters])
        [search_target.name, results] unless results.empty?
      end

Not sure if the ActiveRecord::Base.... kludge will work; returns the
adapter string from script/console.

Tom P

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to