简体   繁体   English

将ActiveAdmin的选择类型过滤器更改为不具有“ any”选项

[英]Changing ActiveAdmin's select-type filter to not have the “any” option

How do I remove the "Any" option from a select-type filter? 如何从选择类型过滤器中删除“任何”选项? Thanks! 谢谢!

Here's a monkeypatch to disable it for all select filters. 这是一个禁用所有选择过滤器的Monkeypatch。 Stick it in initializers/active_admin.rb . 将其粘贴在initializers/active_admin.rb

module ActiveAdmin
  module Inputs
    class FilterSelectInput < ::Formtastic::Inputs::SelectInput

     def input_options
       super.merge(:include_blank => false)
     end
    end
  end
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM