Add string_input_filters namespace setting#9032
Open
Fivell wants to merge 1 commit into
Open
Conversation
Allow consumers to set the default operator list/order for
`as: :string` filters at the namespace level. Per-filter `filters:`
still takes precedence; falling back to the class-level
`ActiveAdmin::Inputs::Filters::StringInput.filters` when no namespace
override is set.
```ruby
ActiveAdmin.setup do |config|
config.namespace :admin do |admin|
admin.string_input_filters = [:eq, :cont]
end
end
```
Today the only way to change the dropdown list across an entire
namespace is destructive monkey-patching of
`ActiveAdmin::Inputs::Filters::StringInput.filters`. This setting
gives the same control without touching the class.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9032 +/- ##
=======================================
Coverage 99.08% 99.08%
=======================================
Files 139 139
Lines 4040 4044 +4
=======================================
+ Hits 4003 4007 +4
Misses 37 37 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
javierjulio
reviewed
Jun 9, 2026
javierjulio
left a comment
Member
There was a problem hiding this comment.
I think this is worthwhile to do at some level because the default contains search can be quite slow on large tables. I've run into this problem and can cause a long running database query with cascading effects sometimes. I'm not sure though I want this either or only as a namespace config. Would it be possible to support at a resource level?
Member
Author
|
@javierjulio will add on resource level as well 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow consumers to set the default operator list/order for
as: :stringfilters at the namespace level. Per-filterfilters:still takes precedence; falling back to the class-levelActiveAdmin::Inputs::Filters::StringInput.filterswhen no namespace override is set.