Casecommons/pg_search — pull request #136 by mauriciopasquier (2013-10-06 20:57:53+00:00)
Title: Mark dynamic document

As stated by the README,

> However, if you call any dynamic methods in :against, the following strategy will be used:
>
> PgSearch::Document.delete_all(:searchable_type => "Ingredient")
> Ingredient.find_each { |record| record.update_pg_search_document }

all it takes for `pg_search` to use that strategy instead of the efficient SQL is using a dynamic method in `:against`, Well, I hit #70. I played a little with this

(columns.uniq.map(&:to_s) - model.column_names).any?

as a method of detecting "columns" from `:against` that aren't database columns, but I broke some tests so instead I tried a more explicit approach. It would be awesome to autodetect it really, but it's nice to have a way to reuse the code inside `pg_search`.