Module: ActiveAdmin::SearchableSelect::ResourceDSLExtension
- Defined in:
- lib/activeadmin/searchable_select/resource_dsl_extension.rb
Overview
Mixin for ActiveAdmin resource DSL
Instance Method Summary collapse
-
#searchable_select_options(name: :all, **options) ⇒ Object
Define a collection action to serve options JSON data for searchable selects.
Instance Method Details
#searchable_select_options(name: :all, **options) ⇒ Object
Define a collection action to serve options JSON data for searchable selects.
{ "results": [{ "id": "1", "text": "Red", "color": "#FFF" }], "pagination": { "more": "false" } }
46 47 48 49 50 51 52 53 |
# File 'lib/activeadmin/searchable_select/resource_dsl_extension.rb', line 46 def (name: :all, **) option_collection = OptionCollection.new(name, ) config.searchable_select_option_collections[name] = option_collection collection_action(option_collection.collection_action_name) do render(json: option_collection.as_json(self, params)) end end |