Commit ffc79906e9c0d14786bf1214eb7224302ffe8ae2
1 parent
4fd5eac8
Exists in
master
and in
29 other branches
ActionItem562: PostgreSQL porting
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2308 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
4 additions
and
0 deletions
Show diff stats
lib/acts_as_searchable.rb
@@ -11,6 +11,10 @@ class << ActiveRecord::Base | @@ -11,6 +11,10 @@ class << ActiveRecord::Base | ||
11 | end | 11 | end |
12 | 12 | ||
13 | ids = find_ids_with_ferret(query, ferret_options)[1].map{|r|r[:id].to_i} | 13 | ids = find_ids_with_ferret(query, ferret_options)[1].map{|r|r[:id].to_i} |
14 | + if ids.empty? | ||
15 | + ids << -1 | ||
16 | + end | ||
17 | + | ||
14 | if db_options[:conditions] | 18 | if db_options[:conditions] |
15 | db_options[:conditions] = sanitize_sql_for_conditions(db_options[:conditions]) + " and #{table_name}.id in (#{ids.join(', ')})" | 19 | db_options[:conditions] = sanitize_sql_for_conditions(db_options[:conditions]) + " and #{table_name}.id in (#{ids.join(', ')})" |
16 | else | 20 | else |