lib/blind_index.rb in blind_index-2.1.0 vs lib/blind_index.rb in blind_index-2.1.1

- old
+ new

@@ -144,14 +144,11 @@ 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) - +ActiveSupport.on_load(:mongoid) do require "blind_index/mongoid" + Mongoid::Document::ClassMethods.include(BlindIndex::Model) Mongoid::Criteria.prepend(BlindIndex::Mongoid::Criteria) Mongoid::Validatable::UniquenessValidator.prepend(BlindIndex::Mongoid::UniquenessValidator) end