This form control allows you to handle your many to many associations.
If, for example, you have something like this:
class Event < ActiveRecord::Base
has_and_belongs_to_many :performers
end
class Performer < ActiveRecord::Base
has_and_belongs_to_many :events
endIn the ActiveAdmin's Event form, you can add:
f.input :performer_ids, as: :selected_listTo get...
Remember: the input name must be:
performer_idsnotperformersand you need to add topermit_paramstheperformer_ids: []key.
url: (optional) This is the URL where to get the results. This URL expects an activeadmin collection Url (like the index action) or anything that uses ransack search gem. By default, the url will be inferred from the attribute. In the example:GET /admin/performers.response_root: (optional) If a request tourlresponds with root, you can indicate the name of that root with this attribute. By default, the gem will try to infer the root from url. For example: ifurlisGET /admin/performers, the root will beperformers. If you have a rootless api, you don't need to worry about this attribute.minimum_input_length: (optional) Minimum number of characters required to initiate the search. It defaults to:1fields: (optional) An array of field names where to search for matches in the related model. If we give many fields, they will be searched with an OR condition.display_name: (optional) You can pass an optionaldisplay_nameto set the attribute to show results on the select. It defaults to:name.width: (optional) You can set the select input width (px or %).order_by: (optional) Order (sort) results by a specific attribute, suffixed with_descor_asc. Eg:description_desc. By default is used the first field in descending direction.predicate: (optional) You can change the default ransack predicate. It defaults tocont
