lib/pg_search/multisearch.rb in pg_search-2.3.2 vs lib/pg_search/multisearch.rb in pg_search-2.3.3

- old
+ new

@@ -3,19 +3,28 @@ require "pg_search/multisearch/rebuilder" module PgSearch module Multisearch class << self - def rebuild(model, clean_up = true) + def rebuild(model, deprecated_clean_up = nil, clean_up: true) + unless deprecated_clean_up.nil? + ActiveSupport::Deprecation.warn( + "pg_search 3.0 will no longer accept a boolean second argument to PgSearchMultisearch.rebuild, " \ + "use keyword argument `clean_up:` instead." + ) + clean_up = deprecated_clean_up + end + model.transaction do PgSearch::Document.where(searchable_type: model.base_class.name).delete_all if clean_up Rebuilder.new(model).rebuild end end end class ModelNotMultisearchable < StandardError def initialize(model_class) + super @model_class = model_class end def message "#{@model_class.name} is not multisearchable. See PgSearch::ClassMethods#multisearchable"