我创建了一个提供搜索条件的表单:
= search_form_for @q do |f|
%h3
Search:
= f.label :category_id
%br
= f.collection_select :category_id_eq, Category.all, :id, :name, :include_blank => true
%br
= f.label "Sub-Category"
%br
= f.collection_select :subcategory_id_eq, Subcategory.all, :id, :name, :include_blank => true, :prompt => "select category!"
%br
= f.label "Contains"
%br
= f.text_field :title_or_details_cont
%br
= f.submit
我还希望能够基于 Rails Geocoder gem 的“Near”功能进行搜索。有谁知道如何合并现有范围,或者特别是如何将“近”范围与 Meta Search 或 Ransack 一起使用?
到目前为止,我所有的尝试都是徒劳的。