Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.3k
Use ActiveRecord Enum labels in current filters status#7790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Use ActiveRecord Enum labels in current filters status#7790
Uh oh!
There was an error while loading.Please reload this page.
Conversation
17eada7 to18135b2Comparecodecovbot commentedMar 13, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@## master #7790 +/- ##======================================= Coverage 98.92% 98.93% ======================================= Files 197 197 Lines 4950 4963 +13 =======================================+ Hits 4897 4910 +13 Misses 53 53
... and2 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell ushow you rate us. Have a feature suggestion?Share it here. ☔ View full report in Codecov by Sentry. |
ff3c597 to0221992CompareAesthetikx commentedMar 30, 2023
Great work on this@harunkumars, thank you! |
codespore commentedJun 27, 2025
Any updates on this PR? |
0221992 to396d75bCompareharunkumars commentedJun 27, 2025
Just had toFix use of deprecated enum syntax. Ready for review. Same example from before with current version of ActiveAdmin |

Fixes Issue#3157 - Display Enum labels for Active Filters in Current Search Status
ActiveAdmin::Filters::ActiveFilter#values controls the displayed value for active filters.
This currently does not have any special handling for Enums.
For e.g. with an enum definition like
enum status: [:inactive, :active], when filtering for :inactive status, the Current Search Status widget shows "Status is0"This PR, uses ActiveRecord::Enum.defined_enums to translate the display value for the filter to the associated label for enums. The Current Search Status widget will now show "Status isInactive"
If a custom collection is provided when registering the ActiveAdmin resource e.g.
filter :status, as: :select, collection: [[:not_active, 0], [:active, 1]]which specifies dropdown labels that are different from the enum labels, then the dropdown label from the custom collection is used. The Current Search Status widget will now show "Status isNot Active"Sample before and after screenshots attached:

Before Fix:
After Fix:
