How can I chain metasearchs' search method ?
@result = User.search(params[:search]).search(params[:filters])
We can call chain method on ActiveRecord like
User.active.male.where( age: 14..20)
its chaining is possible on meta search's result ?
I got it working.. If you had the same problem, you can try following.
The search method of
meta_searchreturnsMetaSearch::Search::ModelNamewhereModelNameis the name of your model. Meta_search provides a methodrelationfor this object. You can callrelationmethod to get anActiveRecord::Relationobject and then you can call the search method again on that object. See the code below to see what I am exactly talking about.Here
@resultis the instance ofMetaSearch::Search::Userso we can callrelationmethod to get an instance ofActiveRecord::Relationi.eand then we can call search method again on this instance. i.e