1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Ensure that Moped and Moped::BSON is defined before testing against Moped::BSON::ObjectID

In my environment we had an issue where ap was causing sidekiq to blow up because apparently our moped is not eager loading Moped::BSON.  Moped was present.
This commit is contained in:
Velkitor 2013-09-25 13:54:21 -07:00
parent 84573bcb85
commit 0b577033ef

View file

@ -20,7 +20,7 @@ module AwesomePrint
cast = :mongoid_class
elsif object.class.ancestors.include?(::Mongoid::Document)
cast = :mongoid_document
elsif (defined?(::BSON) && object.is_a?(::BSON::ObjectId)) || (defined?(::Moped) && object.is_a?(::Moped::BSON::ObjectId))
elsif (defined?(::BSON) && object.is_a?(::BSON::ObjectId)) || (defined?(::Moped) && defined?(::Moped::BSON) && object.is_a?(::Moped::BSON::ObjectId))
cast = :mongoid_bson_id
end
end