Sha256: eb8353d60cd96a83df02b9f1eecd434e166cd2741e667d540a9685b5d79f471b

Contents?: true

Size: 510 Bytes

Versions: 22

Compression:

Stored size: 510 Bytes

Contents

module ActiveAdminAddons
  module RansackFormBuilderExtension
    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
  end
end

::Formtastic::FormBuilder.send :prepend, ActiveAdminAddons::RansackFormBuilderExtension

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
activeadmin_addons-1.10.2 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.10.1 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.10.0 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.9.0 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.8.3 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.8.2 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons_rails6-1.7.2 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.7.1 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.7.0 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.6.0 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.5.0 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.4.0 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.3.0 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.2.0 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.1.2 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.1.1 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.1.0 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.0.1 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-1.0.0 lib/activeadmin_addons/support/enumerize_formtastic_support.rb
activeadmin_addons-0.12.0 lib/activeadmin_addons/support/enumerize_formtastic_support.rb