Making the Rails acts_as_tsearch plugin work with fixtures

acts-as-tsearch is pretty cool, except for the fact that it uses Ruby (app layer) instead of PL/pgSQL (DB layer) to update the tsvectors that are indexed for full text search. That means that fixture data gets inserted without being full text indexed. D’oh!

Here’s some code that changes that.

(I put this in my environment.rb because I’m not quite at the point of shoving all this into a plugin like I probably should.)

(Sorry for the formatting but I like wide lines in my source code and my WP theme doesn’t. Just copy and paste and it should be fine.)

Leave a Reply

Your email address will not be published. Required fields are marked *