Module: ActiveAdmin::Inputs::FilterBase

Includes:
Formtastic::Inputs::Base
Included in:
FilterBooleanInput, FilterCheckBoxesInput, FilterDateRangeInput, FilterNumericInput, FilterSelectInput, FilterStringInput
Defined in:
lib/active_admin/inputs/filter_base.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) collection_from_options

Override the standard finder to accept a proc



22
23
24
25
26
27
28
# File 'lib/active_admin/inputs/filter_base.rb', line 22

def collection_from_options
  if options[:collection].is_a?(Proc)
    template.instance_eval(&options[:collection])
  else
    super
  end
end

- (Object) humanized_method_name

Returns the default label for a given attribute Will use ActiveModel I18n if possible



32
33
34
35
36
37
38
# File 'lib/active_admin/inputs/filter_base.rb', line 32

def humanized_method_name
  if object.base.respond_to?(:human_attribute_name)
    object.base.human_attribute_name(method)
  else
    method.to_s.send(builder.label_str_method)
  end
end

- (Object) input_wrapping(&block)



6
7
8
9
10
11
# File 'lib/active_admin/inputs/filter_base.rb', line 6

def input_wrapping(&block)
  template.(:div,
    template.capture(&block),
    wrapper_html_options
  )
end

- (Object) reflection_for(method)

Returns the association reflection for the method if it exists



41
42
43
# File 'lib/active_admin/inputs/filter_base.rb', line 41

def reflection_for(method)
  @object.base.reflect_on_association(method) if @object.base.respond_to?(:reflect_on_association)
end

- (Boolean) required?

Returns:

  • (Boolean)


13
14
15
# File 'lib/active_admin/inputs/filter_base.rb', line 13

def required?
  false
end

- (Object) wrapper_html_options



17
18
19
# File 'lib/active_admin/inputs/filter_base.rb', line 17

def wrapper_html_options
  { :class => "filter_form_field #{as}" }
end