Skip to content

Fix have_attribute_row selector for labels containing slashes#45

Merged
senid231 merged 2 commits intomasterfrom
copilot/fix-row-class-generation
Apr 9, 2026
Merged

Fix have_attribute_row selector for labels containing slashes#45
senid231 merged 2 commits intomasterfrom
copilot/fix-row-class-generation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

ActiveAdmin normalizes / to _ when generating row CSS classes (e.g. "USA/UAH"row-usa_uah), but attributes_row_selector only replaced spaces, producing an invalid selector tr.row.row-usa/uah > td.

Changes

  • selectors/attributes_table.rb: Replace both whitespace and / with _ using /[\s\/]/ regex, matching ActiveAdmin's class generation
  • spec/lib/selectors/attributes_table_spec.rb: Add unit tests for attributes_row_selector covering the slash and mixed slash/space cases
# Before
label = label.to_s.gsub(' ', '_').downcase
# "USA/UAH" → "tr.row.row-usa/uah > td"  ❌

# After
label = label.to_s.gsub(/[\s\/]/, '_').downcase
# "USA/UAH" → "tr.row.row-usa_uah > td"  ✓

Copilot AI changed the title [WIP] Fix selector for have_attribute_row method with USA/UAH Fix have_attribute_row selector for labels containing slashes Apr 8, 2026
Copilot AI requested a review from senid231 April 8, 2026 12:39
@senid231 senid231 marked this pull request as ready for review April 9, 2026 10:37
@senid231 senid231 merged commit 432c58e into master Apr 9, 2026
37 checks passed
@senid231 senid231 deleted the copilot/fix-row-class-generation branch April 9, 2026 10:38
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.

when user have_attribute_row method with "USA/UAH" first argument we have wrong selector

2 participants