简体   繁体   中英

rails4-autocomplete gem with active_admin and belongs_to relation

Could anyone tell me the correct way for this ? I've got situation like this one:

   collection_action :autocomplete_order_zip_id, :method => :get
   controller do

     autocomplete :order, :zip_id do |item|
       render json: Zip.all
     end

And filter:

   filter :zip_id_contains, :as => :autocomplete, :url => '/admin/orders/autocomplete_order_zip_id',
     :label => "Search Email", :required => false,
     :wrapper_html => { :style => "list-style: none" }

How can I pass my own searching logic for autocomplete ? So I want customer to type ZIP name and system should find suggestions by zip_id in my order table.

我无法以这种方式找到解决方案,因此我将jquery select2用于输入type =“ text”,并带有信息的ajax加载和我的自定义逻辑来获取它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM