How to use ActiveAdmin on models using has_many through association?

前端 未结 6 1282
南笙
南笙 2020-12-12 11:28

I am using ActiveAdmin gem in my project.

I have 2 models using has_many through association. The database schema looks exactly the same as the example in RailsGuide

6条回答
  •  悲&欢浪女
    2020-12-12 11:57

    It's work for me (with chosen)

    permit_params category_ids: []
    
    form do |f|
       inputs 'Shop' do
         input :category_ids, collection: Category.all.collect {|x| [x.name, x.id]}, as: :select, multiple: true, input_html: { class: "chosen-input",  style: "width: 700px;"}
        end
       f.actions
    end
    

提交回复
热议问题