Affects Version/s: 0.9.130
Fix Version/s: 0.9.175
Note: While it's possible to edit a work to have no fandom on both staging and production, staging does not appear to give a 500 error.
Here is the work I (as testy) was able to create the error with on production: http://archiveofourown.org/works/6485314
1. Log in
2. Post > New Work
3. Fill in the form
4. Post Without Preview
5. Edit Tags
6. Choose the "x" next to the fandom tag to remove it
7. Post Without Preview
You may or may not receive a 500 error immediately after posting. You will probably need to wait a few minutes for the error. It might not even work! Isn't this fun?
Regardless of whether the 500 error happens, however, you will not be able to add a chapter to the work:
8. Add Chapter
9. Fill in the form
10. Post Without Preview
11. The new chapter form will just keep reloading without an error or success message, and the chapter count may increase to something odd like 2/1 with no new chapters visible on the work, e.g. http://test.archiveofourown.org/works/1061566 (note that if you go to the Edit page for the work, you can see the chapters listed above the form, so they're... sort of there, sort of not)
Ideally, we should make it so accessing a work without a fandom does not give a 500 error and we should make sure you cannot save a work without a fandom by following the steps above. Just stopping the 500 error would be a big improvement, though.
Tracing the error points to trying to call the name method on nil in https://github.com/otwcode/otwarchive/blob/master/app/controllers/works_controller.rb#L223