diff --git a/lib/mongoid/grid_fs.rb b/lib/mongoid/grid_fs.rb index 60ed44a..cff0e49 100644 --- a/lib/mongoid/grid_fs.rb +++ b/lib/mongoid/grid_fs.rb @@ -170,7 +170,7 @@ def put(readable, attributes = {}) end def binary_for(*buf) - if defined?(Moped::BSON) + if defined?(Moped::BSON::Binary) Moped::BSON::Binary.new(:generic, buf.join) else BSON::Binary.new(buf.join, :generic) @@ -428,7 +428,7 @@ def GridFs.build_chunk_model_for(namespace) self.store_in :collection => "#{ prefix }.chunks" field(:n, :type => Integer, :default => 0) - field(:data, :type => (defined?(Moped::BSON) ? Moped::BSON::Binary : BSON::Binary)) + field(:data, :type => (defined?(Moped::BSON::Binary) ? Moped::BSON::Binary : BSON::Binary)) belongs_to(:file, :foreign_key => :files_id, :class_name => file_model_name) diff --git a/test/mongoid-grid_fs_test.rb b/test/mongoid-grid_fs_test.rb index 593e95a..ddf1516 100644 --- a/test/mongoid-grid_fs_test.rb +++ b/test/mongoid-grid_fs_test.rb @@ -241,7 +241,7 @@ protected def object_id_re - object_id = defined?(Moped::BSON) ? Moped::BSON::ObjectId.new : BSON::ObjectId.new + object_id = defined?(Moped::BSON::ObjectId) ? Moped::BSON::ObjectId.new : BSON::ObjectId.new %r| \w{#{ object_id.to_s.size }} |iomx end