From d52697c0afd951483ed2adf8dc70e2b766acbb26 Mon Sep 17 00:00:00 2001 From: Jeremy Weiland Date: Mon, 7 Jul 2014 16:51:07 -0400 Subject: [PATCH 1/2] changed check for old BSON implementation --- lib/mongoid/grid_fs.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mongoid/grid_fs.rb b/lib/mongoid/grid_fs.rb index 60ed44a..16dfc71 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) From 26a81fb3c97b31183c6c2d5ba8c114cb37702ca8 Mon Sep 17 00:00:00 2001 From: Jeremy Weiland Date: Mon, 7 Jul 2014 17:50:46 -0400 Subject: [PATCH 2/2] replace other instances of bad constant --- lib/mongoid/grid_fs.rb | 2 +- test/mongoid-grid_fs_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mongoid/grid_fs.rb b/lib/mongoid/grid_fs.rb index 16dfc71..cff0e49 100644 --- a/lib/mongoid/grid_fs.rb +++ b/lib/mongoid/grid_fs.rb @@ -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