Module: ActiveAdminAddons::SelectFilterInputExtension

Defined in:
lib/activeadmin_addons/support/select_filter_input_extension.rb

Instance Method Summary collapse

Instance Method Details

#collectionObject



7
8
9
10
11
12
13
# File 'lib/activeadmin_addons/support/select_filter_input_extension.rb', line 7

def collection
  if !options[:collection] && collection_from_enum?
    EnumUtils.options_for_select(klass, method.to_s, use_db_value: true)
  else
    super
  end
end

#collection_from_enum?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/activeadmin_addons/support/select_filter_input_extension.rb', line 3

def collection_from_enum?
  klass.respond_to?(:defined_enums) && klass.defined_enums.has_key?(method.to_s)
end