lib/blind_index.rb in blind_index-1.0.0 vs lib/blind_index.rb in blind_index-1.0.1

- old
+ new

@@ -143,5 +143,15 @@ unless ActiveRecord::VERSION::STRING.start_with?("5.1.") ActiveRecord::Validations::UniquenessValidator.prepend(BlindIndex::Extensions::UniquenessValidator) end end + +if defined?(Mongoid) + # TODO find better ActiveModel hook + require "active_model/callbacks" + ActiveModel::Callbacks.include(BlindIndex::Model) + + require "blind_index/mongoid" + Mongoid::Criteria.prepend(BlindIndex::Mongoid::Criteria) + Mongoid::Validatable::UniquenessValidator.prepend(BlindIndex::Mongoid::UniquenessValidator) +end