activeadmin_addons
activeadmin_addons copied to clipboard
Allow nested_select request levels by other attributes
By default, the nested select input uses the index action of the different levels to get the data. For example, the level 2 will perform an ajax request to /admin/[model1]&[model2]_id_eq=[selected_[model2]_id] to get the regions for a given country.
f.input :city_id, as: :nested_select,
level_1: { attribute: :country_id },
level_2: { attribute: :region_id },
level_3: { attribute: :city_id }
As suggested in issue #89 it could be useful to select by a different attribute than id, especially in cases where model was created with id: false
and primary key t.primary_key :custom_column
.
Any progress on this? This is a blocker when using has_many through
with a key that is not id
. Is there a method somewhere that can be monkey patched until this is completed and rolled into a new version? Also, will the fix be applicable to the other similar components that use associations like :selected_list
and :search_select
?