UM-USElab/gradecraft-development — pull request #696 by demarius (2014-01-08 06:20:00+00:00)
Title: Fix submission and upload errors.

Rails is creating submission_files pre-emptively. This commit
removes unused objects before Submission.save and Submission.update
to prevent sparking a database error from the upload's filepath
column being empty.

@chcholman I'm not sure why the form assumes that a submission_file exists, but it does, and passes this back in params when one *isn't* uploaded:
```"submission" => { "submission_files_attributes" => { "0" => { "id" => whatever, "filepath" => ""}}}```

This sucks because `@submission.save` and @submission.update_attributes both stick `""` into the filepath column in the submission_files table, which can't be null.

So right now I'm checking the parameters to see if there actually are any submission_files, and I delete the nested attribute hash if there aren't. This works, but it seems dirty. Is there anything else we can do?