Tuesday 15 July 2014

ruby on rails - Preserve Ransack search between multiple endpoints/controller functions -


I have a model that updates its results through AJAX calls and endpapping what I designated Is / model / filter , and I am trying to include the search in the mix I have added the ranks and it works just fine on the index (if I only search), but When I apply a filter, I still want to work.

Model = DF filter @

Search (Param [: Q]) @model = @Search. However, when an AJAX call executes this function, I get a result that does not use search terms.

I want to make sure that either parameters [: Q] reach / model / filter as it was when / Model / Index was loaded (a JS solution), or when I call Filters (Ruby Solution), I use the same @search I want to be able to reach the object.

Is the base here, or something that is easy to do?

I found the solution after a few more searches.

In / model / index , I added Rails.cach e.write ("q", parameter [: q]) .

Then, in / model / filter , I said parameters [: q] = Rails.cache.read ("q") before I called @search = Model.search (Params [: q])

No comments:

Post a Comment