Repository navigation
fix: render the correct host sponsor on events listing cards - #2981
Merged
Merged
Conversation
Eager-loading workshop_host together with :sponsors routes both through the workshop_sponsors table in one join; the host scope then binds to the wrong table alias, so workshop_host comes back nil or points at a non-host sponsor and event cards show the wrong venue. Preload the host instead, mirroring Listable.most_recent. Sponsors and organiser avatars on event cards now render in name order; previously the order followed join-row order.
Sorting sponsors and organisers by name compared nil against String when a member or sponsor has no name (member names are only required for active members), which would raise while rendering a card. Sort with a nil-safe key instead. Bump the event card fragment cache version to v3: previously cached cards rendered the wrong venue and must not be served after this fix deploys.
mroderick
marked this pull request as ready for review
October 1, 2026 12:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2975.
Summary
Workshop cards on the events listing could show the wrong sponsor as the venue, or none at all.
EventsController#load_eventseager-loadedworkshop_host: :sponsortogether with:sponsors; both route through theworkshop_sponsorstable in one join, and the host scope then binds to the wrong table alias, soworkshop_hostcame back nil or pointing at a non-host sponsor on a plan-dependent subset of cards.The host is now preloaded instead of joined, the same pattern
Listable.most_recentand the chapter controller already use. Sponsor and organiser lists on cards also render in name order now (previously join-row order), and the card fragment cache version bumps to v3 so cards cached with the wrong venue are not served after deploy.Review notes
workshop_sponsorsrecords (the issue's other candidate, which would also cut join fan-out). Preload is the smaller change and matches the existing pattern; the derivation approach would needWorkshop#hostor the presenter to read from loaded through records.app/queries/dashboard_query.rbeager-loads:workshop_hostalongside:sponsorsin one join — the same alias trap, left out of this PR as follow-up work.Testing
New specs cover: the host resolves to the host sponsor for every workshop on a page, the full sponsor list is present, name ordering for sponsors and organisers, and sorting with a blank member name (member names are only required for active members).
Post-deploy validation
The venue on a card is the visible change: spot-check
/events/pastand/events/upcomingafter deploy — each workshop card should name its host sponsor. The v3 cache key re-warms the card cache on first render. Watch Rollbar forArgumentErrorfrom presenter sorting as the failure signal; nil-name records were the trigger class the nil-safe sort covers.