Skip to content

How to use this gem in custom active admin form page? #42

@pawlarius

Description

@pawlarius

Is it possible to use searchable in custom Active Admin page?
If yes, how to do it?

All the docs examples is using the normal page like this ActiveAdmin.register "Model Here".

If I try to register custom page, searchable_select won't work in this form 🤔

ActiveAdmin.register_page 'Product' do
  page_action :create_product, method: :post do
  end

  content do
    confirm_submit = 'return confirm("Do you really want to create this product?")'
    form_for :data, url: admin_product_create_product_path, html: { onsubmit: confirm_submit }, method: :post do |f|
    
    # 1. This doesnt work.
    f.input(:additional_category,
            as: :searchable_select,
            ajax: { resource: Product })
    
    # 2. This doesnt work either.
    # f.input(:product_id,
    #   as: :searchable_select,
    #   ajax: { resource: Brand, collection_name: :products })
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions