xeroshogun
xeroshogun

Reputation: 1092

ActiveAdmin - Set default value of dropdowns in filter

I am new to active admin and which to change the default selection on many dropdown menus from contains to equals. Is there a quick way to do this?

Upvotes: 1

Views: 939

Answers (1)

Fivell
Fivell

Reputation: 11929

you can monkey-patch it . Something like this might work https://gist.github.com/Fivell/56215c4da008c49585eb You can put gist contents it to the end of active_admin initializer

UPD:

module ActiveAdmin
  module Inputs
    module Filters
      module StringInputExt

        def self.included(base)
          base.class_eval do
            @filters = [:equals, :contains, :starts_with, :ends_with]
          end
        end
      end
    end
  end
end

ActiveAdmin::Inputs::Filters::StringInput.send(:include, ActiveAdmin::Inputs::Filters::StringInputExt)

Upvotes: 1

Related Questions