I'm using the very helpful has_scope gem. I have an index page created by passing scopes in a link.
<%= user_collections_path(@user, got: true) %>
On that index page I can query the current_scopes.
I have a pretty standard ransack search form on that page but using it returns results without any scopes.
How can I pass the current_scopes on to the search? I tried using a hidden field but couldn't get it to work. I thought if I could pass the scopes in a link I ought to be able to pass them in a form but after googling I'm not sure that is true.
Search form
<%= search_form_for @search, :html => {:method => :post} do |f| %>
<%= f.text_field :name_or_miniature_name_cont, class: "span3" %>
<%= f.submit "Search", class: "btn" %>
<% end %>
Index method
def index
@user = User.find_by_username(params[:user_id])
@search = apply_scopes(@user.collections).search(params[:q])
@search.sorts = 'created_at desc' if @search.sorts.empty?
@collections = @search.result.paginate(page: params[:page])
end