Module: ActiveAdminAddons::RansackFormBuilderExtension

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

Instance Method Summary collapse

Instance Method Details

#input(method, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/activeadmin_addons/support/enumerize_formtastic_support.rb', line 3

def input(method, options = {})
  if object.is_a?(::Ransack::Search)
    klass = object.klass

    if klass.respond_to?(:enumerized_attributes) && (attr = klass.enumerized_attributes[method])
      options[:collection] ||= attr.options
      options[:as] = :select
    end
  end

  super(method, options)
end