activeadmin_addons
activeadmin_addons copied to clipboard
Allow nested_select multiple: true option
I find this PR https://github.com/platanus/activeadmin_addons/pull/72 (created by @groony ) it looks like this feature should be already present, bu I did not find any documentation on how to activate and use it, I try:
f.input :city_ids, as: :nested_select, multiple: true,
level_1: { attribute: :country_id },
level_2: { attribute: :region_id },
level_3: { attribute: :city_ids }
or
f.input :city_ids, as: :nested_select,
level_1: { attribute: :country_id },
level_2: { attribute: :region_id },
level_3: { attribute: :city_ids, multiple: true }
and it is not works for me, cities select still not provide ability to select several cities.
It will be very useful to add ability to use nested_select with multiple: true option for has_many and has_and_belongs_to_many associations. Here is workflow, related to example in README:
- user select Country
- user select Region
- user can select several Cities using Select2 multiple feature
More complicated variant: in addition to workflow above:
- user select new Country
- user select another Region
- user can add several new Cities to already selected list (previously selected cities shouldn't be removed)
And one more complicated case: use multiple: true for each level, so user can select several Countries, and several Regions to see Cities related to one of selected Region
I was just thinking about this same thing - would be really useful to see support for this use case.
I do have working solution on this problem, but it needs https://github.com/platanus/activeadmin_addons/pull/264 to work properly
I will make pr as soon as 264 pr will be merged
@gen1321 Nice! I asked the author of that PR to rebase his branch, so we can merge it but it seems that it was too late. Maybe if you have a working solution for that PR also, we could review it and eventually merge it.
Hey @gen1321 just letting you know that #264 has been merged!
@gen1321 do you still plan sending that PR? If you don't, I'll try to implement this myself