Permalink
Browse files

Merge pull request #38 from ggennrich/master

Fixed mongoid_search to work with mongoid 3.0rc
  • Loading branch information...
2 parents 258e9b3 + 7ff78f8 commit 61cebb0db8f2de1b7a28fd59cc53929c23f88b5e @mauriciozaffari mauriciozaffari committed Jun 18, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/mongoid_search/mongoid_search.rb
@@ -26,7 +26,8 @@ def search_in(*args)
self.search_fields = (self.search_fields || []).concat args
field :_keywords, :type => Array
- index :_keywords, :background => true
+
+ Gem.loaded_specs["mongoid"].version.to_s.include?("3.0") ? (index({_keywords: 1}, {background: true})) : (index :_keywords, :background => true)
before_save :set_keywords
end

0 comments on commit 61cebb0

Please sign in to comment.