Skip to content

Conversation

@dixonnataliej
Copy link
Contributor

Resolves #8813

Fixes custom string labels being titleized in attributes_table, which breaks acronym capitalization in show views.
The header_content_for method was processing all labels through titleize, regardless of whether they were symbols (attribute names) or strings (custom display labels). This caused issues like:

"Registration ID" → "Registration Id"
"LMnO" -> "L Mn O"

This PR makes AttributesTable consistent with TableFor::Column.pretty_title by distinguishing between:

Symbols (:registration_id) - processed through human_attribute_name with i18n lookup and titleize fallback
Strings ("Registration ID") - preserved exactly as provided

Changes

Modified header_content_for in lib/active_admin/views/components/attributes_table.rb to check attribute type before processing
Added regression test in spec/unit/views/components/attributes_table_spec.rb

@javierjulio javierjulio changed the title [#8813] Preserve custom string labels in AttributesTable headers Preserve custom string labels in AttributesTable headers Sep 30, 2025
@codecov
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.08%. Comparing base (a888d02) to head (8b9c824).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8815   +/-   ##
=======================================
  Coverage   99.08%   99.08%           
=======================================
  Files         139      139           
  Lines        4043     4046    +3     
=======================================
+ Hits         4006     4009    +3     
  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.

@javierjulio javierjulio force-pushed the 8813-show-attributes-table-titles branch from b4509be to 8b9c824 Compare October 10, 2025 23:19
Copy link
Member

@javierjulio javierjulio left a comment

Choose a reason for hiding this comment

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

Thanks!

@javierjulio javierjulio merged commit c2f2dc1 into activeadmin:master Oct 11, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show Attributes Table Incorrectly Capitalizes Custom Row Labels/Titles

3 participants