Conversation
A story can reference multiple workshops (each linked to the curriculum or a free-text name), and a workshop can connect multiple stories. The workshop page lists the stories that use it, and 'New story' from a workshop pre-selects it. The join is a StoryWorkshop model on a stories_workshops table (has_many :through both ways). The legacy stories.workshop_id / external_workshop_title columns are kept as a safety copy; display falls back to them when a story has no join rows yet. Migration is schema-only, no backfill. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Workshops and stories are both unbounded, so loading the full collection into a native <select> per nested row doesn't scale. Search each on demand via the existing remote-select (TomSelect) control instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…p read-only - Add a unique index on stories_workshops [story_id, workshop_id] (folded into the create migration) so a concurrent double-submit can't slip a duplicate link past the model validation. NULL workshop_id rows (external-title-only) stay unaffected — MySQL allows multiple NULLs. - Surface the kept legacy stories.workshop_id / external_workshop_title columns read-only on the edit form so a persisted story's pre-join workshop data stays visible instead of silently hiding. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
🤖 suggested review level: 5 Inspect 🔬 new join table + model, both edit forms reworked, decorator/importer/sort changes
A story can now reference multiple workshops and vice versa. Each linked to the workshop curriculum or typed in for one that isn't listed — and the relationship is editable from both sides. Facilitators couldn't previously connect a story to more than one workshop, or see a workshop's stories from the curriculum.
We've left in that initial relationship in order to support a data migration to retain existing connections.
What you can do now
How it's modeled
StoryWorkshopon tablestories_workshops(has_many :throughboth directions). Each row carries an optionalworkshop_idand/or an optionalexternal_workshop_title, plusposition. A row with both renders "Name (from the Workshop)".stories.workshop_id/external_workshop_titlecolumns are kept as a safety net; display falls back to them when a story has no join rows yet, and the story edit form shows them read-only ("Previously linked") so a persisted story's pre-join workshop data never silently hides.stories_workshops [story_id, workshop_id]backs the model's uniqueness validation (a concurrent double-submit can't slip a duplicate past it). External-title-only rows have aNULLworkshop_id, which MySQL exempts, so a story can still carry several unlisted-workshop rows.Notes for the reviewer
Storyto theremote_searchableset +search/:modelallowlist and aStoryPolicy#search?(authenticated) rule.Storyrecords. Kept both.Testing
StoryWorkshop(needs a workshop or a title; no duplicate workshop per story).Follow-up
🤖 Generated with Claude Code