lib/pg_search/document.rb in pg_search-0.3.3 vs lib/pg_search/document.rb in pg_search-0.3.4
- old
+ new
@@ -6,10 +6,17 @@
set_table_name :pg_search_documents
belongs_to :searchable, :polymorphic => true
before_validation :update_content
- pg_search_scope :search, :against => :content
+ pg_search_scope :search, lambda { |*args|
+ if PgSearch.multisearch_options.respond_to?(:call)
+ options = PgSearch.multisearch_options.call(*args)
+ else
+ options = PgSearch.multisearch_options.reverse_merge(:query => args.first)
+ end
+ options.reverse_merge(:against => :content)
+ }
private
def update_content
methods = Array.wrap(searchable.pg_search_multisearchable_options[:against])