Allow clearing story author on edit form#1544
Open
maebeale wants to merge 1 commit into
Open
Conversation
The author select used Rails' prompt: option, which only renders the placeholder when no value is selected. On an existing story the author is already set, so no blank option existed and the field could not be returned to 'Select an author'. Switch to include_blank: so the blank option always renders, matching the new-story behavior. Fixes #1517 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
maebeale
commented
Jun 5, 2026
| <%= f.input :created_by_id, | ||
| collection: @users.map { |u| [ u.full_name_with_email, u.id ] }, | ||
| prompt: "Select an author", | ||
| include_blank: "Select an author", |
Collaborator
Author
There was a problem hiding this comment.
Switched from prompt: to include_blank: here. prompt: only renders the placeholder <option> when the field has no value, so on an already-set story the blank option was absent and the author couldn't be cleared. include_blank: always renders it — matching workshop_id/organization_id above.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a UX bug on the story edit form where an already-selected Story author could not be cleared back to the placeholder option, by ensuring the blank <option> is always rendered even when a value is currently selected.
Changes:
- Switches the Story author select from
prompt:toinclude_blank:so the blank option exists on edit when an author is already set. - Adds a view spec to assert the edit form includes the blank author option needed to clear the selection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
app/views/stories/_form.html.erb |
Ensures the author select always renders a blank option so users can clear an existing selection. |
spec/views/stories/edit.html.erb_spec.rb |
Adds coverage verifying the edit form renders the blank author option. |
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.
Closes #1517
What is the goal of this PR and why is this important?
How did you approach the change?
prompt:option, which only renders the placeholder<option>when no value is selected. On an existing story the author is already set, so the blank option was never rendered and there was nothing to select to clear the field.prompt: "Select an author"toinclude_blank: "Select an author", which always renders the blank option. This matches howworkshop_idandorganization_idalready behave on the same form, and leaves the new-story form unchanged.select-placeholderstyling andonchangehandler already react to an empty value, so clearing now correctly re-applies the gray placeholder style.Testing
optionforstory[created_by_id](red before the fix, green after).spec/views/stories/edit.html.erb_spec.rbandnew.html.erb_spec.rbpass (23 examples, 0 failures).Anything else to add?
spotlighted_facilitator_id) has the identicalprompt:pattern and the same limitation. It's out of scope for issue Edit story: can't deselect a story author to return to 'Select an author' #1517, but happy to fix it in this PR or a follow-up if desired.