A one-word Rails fix for a 404 in global search.
Short answer
In Hitobito's global search, pressing Enter on an invoice number worked, but clicking the invoice suggestion in the popup returned a 404. The suggestion URL was built from the wrong route helper. The fix uses invoice_path instead of invoices_path . It was merged as PR #4436 and closed issue #4399 .
The problem
Hitobito is an open-source Rails application for managing organizations and their members. Issue #4399, reported on version 2.10.3, described the 404 when clicking an invoice suggestion in global search.
Root cause
According to the PR, the quick search partial built its invoice base URL from the JSON:API invoices_path helper instead of the top-level invoice_path helper, so the generated suggestion link didn't resolve.
The fix
event_url: event_path(1).gsub(/\/1$/, ''), - invoice_url: invoices_path(1).gsub(/\/1$/, '') } + invoice_url: invoice_path(1).gsub(/\/1$/, '') }
Enter fullscreen mode
Exit fullscreen mode
By the…