Sha256: b112bf593b781a2e6ec84a572ba56b773073c5285b5b60a150cf01828f7a8e20

Contents?: true

Size: 604 Bytes

Versions: 6

Compression:

Stored size: 604 Bytes

Contents

require "pg_search/multisearch/rebuilder"

module PgSearch
  module Multisearch

    class << self
      def rebuild(model, clean_up=true)
        model.transaction do
          PgSearch::Document.where(:searchable_type => model.name).delete_all if clean_up
          Rebuilder.new(model).rebuild
        end
      end
    end

    class ModelNotMultisearchable < StandardError
      def initialize(model_class)
        @model_class = model_class
      end

      def message
        "#{@model_class.name} is not multisearchable. See PgSearch::ClassMethods#multisearchable"
      end
    end
  end
end


Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pg_search-0.7.8 lib/pg_search/multisearch.rb
pg_search-0.7.7 lib/pg_search/multisearch.rb
pg_search-0.7.6 lib/pg_search/multisearch.rb
pg_search-0.7.5 lib/pg_search/multisearch.rb
pg_search-0.7.4 lib/pg_search/multisearch.rb
pg_search-0.7.3 lib/pg_search/multisearch.rb