-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash when adding invalid documents to answers
We were rendering the `new` action, but that action doesn't exist. Before commit ec861ca, we were rendering the `edit` action of an answer, which was confusing as well. Note that, when adding an invalid document, `@answer.documents` contains that invalid document (which is not present in the database). Since we're rendering the index, this new document would appear in the list of the documents that can be deleted; to avoid that, we're kind of "reloading" the answer object in the component by finding the record in the database. We aren't using `@answer.reload` because doing so would remove the validation errors.
- Loading branch information
Showing
4 changed files
with
31 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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