class ActiveAdmin::Inputs::Filters::SelectInput

Public Instance Methods

collection() click to toggle source

Provides an efficient default lookup query if the attribute is a DB column.

Calls superclass method
# File lib/active_admin/inputs/filters/select_input.rb, line 39
def collection
  if !options[:collection] && column
    pluck_column
  else
    super
  end
end
include_blank() click to toggle source

Provide the AA translation to the blank input field.

Calls superclass method
# File lib/active_admin/inputs/filters/select_input.rb, line 24
def include_blank
  I18n.t 'active_admin.any' if super
end
input_html_options_name() click to toggle source
# File lib/active_admin/inputs/filters/select_input.rb, line 28
def input_html_options_name
  "#{object_name}[#{input_name}]" # was "#{object_name}[#{association_primary_key}]"
end
input_name() click to toggle source
# File lib/active_admin/inputs/filters/select_input.rb, line 7
def input_name
  return method if seems_searchable?

  searchable_method_name + (multiple? ? '_in' : '_eq')
end
multiple_by_association?() click to toggle source

Would normally return true for has_many and HABTM, which would subsequently cause the select field to be multi-select instead of a dropdown.

# File lib/active_admin/inputs/filters/select_input.rb, line 34
def multiple_by_association?
  false
end
pluck_column() click to toggle source
# File lib/active_admin/inputs/filters/select_input.rb, line 47
def pluck_column
  distinct = ActiveAdmin::Dependency.rails >= 4 ? :distinct : :uniq
  klass.reorder("#{method} asc").public_send(distinct).pluck method
end
searchable_method_name() click to toggle source
# File lib/active_admin/inputs/filters/select_input.rb, line 13
def searchable_method_name
  if searchable_has_many_through?
    "#{reflection.through_reflection.name}_#{reflection.foreign_key}"
  else
    name = method.to_s
    name.concat '_id' if reflection
    name
  end
end