Permalink
Browse files

updated for better Mongoid 3 support + README updates

  • Loading branch information...
1 parent 5083ba1 commit f4d81e1a28e936f78a6d95ac1bcdafbe6cccd817 @kristianmandrup committed Aug 7, 2012
Showing with 16 additions and 7 deletions.
  1. +1 −1 .rvmrc
  2. +2 −1 Gemfile
  3. +4 −3 README.md
  4. +1 −1 VERSION
  5. +7 −1 examples/example.rb
  6. +1 −0 lib/sunspot/mongoid.rb
View
2 .rvmrc
@@ -1 +1 @@
-rvm use 1.9.2@sunspot-mongoid --create
+rvm use 1.9.3@sunspot-mongoid --create
View
@@ -1,6 +1,7 @@
source 'http://rubygems.org'
-gem "mongoid", ">= 0"
+gem 'moped', '>= 1.2'
+gem "mongoid", ">= 3"
gem "sunspot", "~>2.0.0.pre"
gem "sunspot_rails", "~>2.0.0.pre"
View
@@ -1,7 +1,7 @@
sunspot_mongoid
====
-A Sunspot wrapper for Mongoid.
+A Sunspot wrapper for Mongoid. Currently supports versions: 2.x, 3.0.x and 3.1.x
Install
----
@@ -54,8 +54,9 @@ Reindex all solr models that are located in your application's models directory.
Links
----
-* [sunspot](http://github.com/outoftime/sunspot)
-* [sunspot_rails](http://github.com/outoftime/sunspot/tree/master/sunspot_rails/)
+* [sunspot](https://github.com/sunspot/sunspot)
+
+Includes the 'sunspot_rails' gem
Copyright
----
View
@@ -1 +1 @@
-0.5.2
+0.5.2.1
View
@@ -1,8 +1,14 @@
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'sunspot_mongoid'
+test_db = 'sunspot-mongoid-test'
+
Mongoid.configure do |config|
- config.master = Mongo::Connection.new.db('sunspot-mongoid-test')
+ if defined?(Moped)
+ config.connect_to(test_db)
+ else
+ config.master = Mongo::Connection.new.db(test_db)
+ end
end
# model
View
@@ -78,6 +78,7 @@ def load_all(ids)
def criteria(ids)
c = @clazz.criteria
+ # Mongoid 3 support
c.respond_to?(:for_ids) ? c.for_ids(ids) : c.id(ids)
end
end

0 comments on commit f4d81e1

Please sign in to comment.