I’ve added a fulltext searching database to my existing webapp that is built with Rails and uses the active_admin gem. The fulltext database is built on elastic search and uses the Tire gem. The active_admin gem has a dependency requirement of the metasearch gem which defines the Model.search method.
The problem is that the metasearch gem overrides the search method for the tire search gem and I can’t seem to alias the search method in the tire gem back into the model. Does anyone know how I can do this?
— Solution —
Update: The solution is to setup an initializer to add the following method:
def search_for(*args,&block)
tire.__send__(:search, *args, &block)
end
I’ve come up with a working solution. Basically, you need to just set the search method to be called
search_forinstead ofsearch.Create a helper file called tire_helper.rb within app/helpers.
And for each model that uses tire then use this:
You can now search normally on your model(s) with the following method: