I hope someone may have solved this issue before. It involves rails3,
kaminari and pg_search.

I've got pg_search working, but now the search is returned and the
default order is not maintained. I don't mind having the subset
returned in any order. But I want to maintain the subset of records
returned by the search query and still be able to click on the column
headers to sort the new data subset.

Now, when I select any of the column headers after a search, I get all
of the db records displayed. If I change the search box to contain no
text, I'd like all records should be displayed.

Is there a sequence of method calls that I can setup so that the
subset of data is maintained while the column headers are still
sortable?

I am now using this call sequence in my controller:

from: /tips/app/controllers/tips_controller.rb
...
  def index
    @tips = Tip.text_search(params[:query]).order(sort_column + ' ' +
sort_direction).page(params[:page])
  end
...

Can anyone suggest a better approach?

Thanks,

Capt. Downer

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to