{"id":14955582,"url":"https://github.com/blocknotes/activeadmin_select_many","last_synced_at":"2025-10-08T18:02:37.485Z","repository":{"id":48475595,"uuid":"103990874","full_name":"blocknotes/activeadmin_select_many","owner":"blocknotes","description":"ActiveAdmin plugin for one-to-many / many-to-many / many-to-one associations","archived":false,"fork":false,"pushed_at":"2022-03-18T17:53:06.000Z","size":116,"stargazers_count":25,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-01T18:38:21.739Z","etag":null,"topics":["activeadmin","activeadmin-plugin","rails","rails5","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blocknotes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["blocknotes"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2017-09-18T20:54:46.000Z","updated_at":"2023-12-26T20:34:52.000Z","dependencies_parsed_at":"2022-08-30T07:01:23.077Z","dependency_job_id":null,"html_url":"https://github.com/blocknotes/activeadmin_select_many","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/blocknotes/activeadmin_select_many","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocknotes%2Factiveadmin_select_many","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocknotes%2Factiveadmin_select_many/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocknotes%2Factiveadmin_select_many/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocknotes%2Factiveadmin_select_many/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blocknotes","download_url":"https://codeload.github.com/blocknotes/activeadmin_select_many/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocknotes%2Factiveadmin_select_many/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278302542,"owners_count":25964521,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activeadmin","activeadmin-plugin","rails","rails5","ruby"],"created_at":"2024-09-24T13:11:24.199Z","updated_at":"2025-10-08T18:02:37.457Z","avatar_url":"https://github.com/blocknotes.png","language":"Ruby","readme":"# ActiveAdmin Select Many\n[![gem version](https://badge.fury.io/rb/activeadmin_select_many.svg)](https://badge.fury.io/rb/activeadmin_select_many)\n[![gem downloads](https://badgen.net/rubygems/dt/activeadmin_select_many)](https://rubygems.org/gems/activeadmin_select_many)\n[![specs](https://github.com/blocknotes/activeadmin_select_many/actions/workflows/specs.yml/badge.svg)](https://github.com/blocknotes/activeadmin_select_many/actions/workflows/specs.yml)\n\nAn Active Admin plugin which improves one-to-many / many-to-many / many-to-one associations selection using 2 new inputs: **select_many** and **select_one** (jQuery required).\n\nFeatures for *select_many*:\n\n- search box;\n- available items on the left, selected items on the right;\n- local/remote collections;\n- double click to add/remove items;\n- sortable (with up/down buttons);\n- key bindings to improve accessibility.\n\nFeatures for *select_one*:\n\n- search box;\n- selected items on the right;\n- remote collections;\n- counter of items found;\n- can be used as filter;\n- key bindings to improve accessibility.\n\n![screenshot](screenshot.png)\n\n*(inspired by RailsAdmin associations selector)*\n\n## Install\n\n- Add to your Gemfile:\n`gem 'activeadmin_select_many'`\n- Execute bundle\n- Add at the end of your ActiveAdmin styles (_app/assets/stylesheets/active_admin.scss_):\n`@import 'activeadmin/select_many';`\n- Add at the end of your ActiveAdmin javascripts (_app/assets/javascripts/active_admin.js_):\n`//= require activeadmin/select_many`\n- Use the input with `as: :select_many` in Active Admin model conf\n\n## Options\n\n- **collection**: local collection\n- **counter_limit**: if results count is greater than or equal to this limit a '+' is shown\n- **filter_form**: for *select_one* only, allow to use it as filter\n- **include_blank**: for *select_one* only, default true, allow to include a blank value on top\n- **member_label**: key to use as text for select options\n- **placeholder**: placeholder string for search box\n- **remote_collection**: JSON path\n- **search_param**: parameter to use as search key (ransack format)\n- **selected**: force value selection (array for *select_many*, single value for *select_one*)\n- **size**: number of rows of both the selects (default: 4)\n- **sortable**: set to true to enable sortable buttons (default: not set)\n\n## Examples with select_many\n\nAdd to ActiveAdmin model config, in *form* block.\n\n- Local collection (no AJAX calls):\n`f.input :sections, as: :select_many`\n- Remote collection (using AJAX):\n`f.input :tags, as: :select_many, remote_collection: admin_tags_path( format: :json )`\n- Changing search param and text key (default: *name*):\n`f.input :tags, as: :select_many, remote_collection: admin_tags_path( format: :json ), search_param: 'category_contains', member_label: 'category', placeholder: 'Type something...'`\n- Sortable (items position must be saved manually):\n`f.input :tags, as: :select_many, remote_collection: admin_tags_path( format: :json ), sortable: true`\n\nExample to update *position* field:\n\n```rb\n  after_save :on_after_save\n  controller do\n    def on_after_save( object )\n      if params[:article][:section_ids]\n        order = {}\n        params[:article][:section_ids].each_with_index { |id, i| order[id.to_i] = i }\n        object.sections.each { |item| item.update_column( :position, order[item.id].to_i ) }\n      end\n    end\n  end\n```\n\nExample to enable JSON response on an ActiveAdmin model:\n\n```rb\nActiveAdmin.register Tag do\n  config.per_page = 30  # to limit served items\n  config.sort_order = 'name_asc'\n  index download_links: [:json]\nend\n```\n\n## Examples with select_one\n\nIn a form:\n\n`f.input :article, as: :select_one, placeholder: 'Search...', remote_collection: admin_articles_path( format: :json ), search_param: 'title_contains', member_label: 'title'`\n\nAs filter:\n\n`filter :article_id_eq, as: :select_one, filter_form: true, placeholder: 'Search...', search_param: 'title_contains', member_label: 'title', remote_collection: '/admin/articles.json'`\n\n## Notes\n\n- To use this plugins with ActiveAdmin 1.x please use the version 0.3.4\n\n## Do you like it? Star it!\n\nIf you use this component just star it. A developer is more motivated to improve a project when there is some interest. My other [Active Admin components](https://github.com/blocknotes?utf8=✓\u0026tab=repositories\u0026q=activeadmin\u0026type=source).\n\nOr consider offering me a coffee, it's a small thing but it is greatly appreciated: [about me](https://www.blocknot.es/about-me).\n\n## Contributors\n\n- [Mattia Roccoberton](http://blocknot.es): author\n\n## License\n\n[MIT](LICENSE.txt)\n","funding_links":["https://github.com/sponsors/blocknotes"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblocknotes%2Factiveadmin_select_many","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblocknotes%2Factiveadmin_select_many","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblocknotes%2Factiveadmin_select_many/lists"}