Skip to content

Add string_input_filters namespace setting#9032

Open
Fivell wants to merge 1 commit into
masterfrom
namespace-string-input-filters
Open

Add string_input_filters namespace setting#9032
Fivell wants to merge 1 commit into
masterfrom
namespace-string-input-filters

Conversation

@Fivell

@Fivell Fivell commented May 23, 2026

Copy link
Copy Markdown
Member

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.

ActiveAdmin.setup do |config|
  config.namespace :admin do |admin|
    admin.string_input_filters = [:eq, :cont]
  end
end

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.
@Fivell Fivell requested review from javierjulio and tagliala May 23, 2026 19:27
@codecov

codecov Bot commented May 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.08%. Comparing base (5164bbb) to head (8b0c985).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Fivell Fivell self-assigned this Jun 1, 2026

@javierjulio javierjulio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@Fivell

Fivell commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

@javierjulio will add on resource level as well 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants