Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
check for the version of mongoid to determine index syntax type
  • Loading branch information
ggennrich committed Jun 14, 2012
1 parent caad8d5 commit dce432d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/mongoid_search/mongoid_search.rb
Expand Up @@ -26,7 +26,8 @@ def search_in(*args)
self.search_fields = (self.search_fields || []).concat args self.search_fields = (self.search_fields || []).concat args


field :_keywords, :type => Array field :_keywords, :type => Array
index({_keywords: 1}, {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 before_save :set_keywords
end end
Expand Down

0 comments on commit dce432d

Please sign in to comment.