-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move validation to models / change forms to embed submodels. #24
Comments
Is this now basically done, to your satisfaction? |
There's still a couple cases of obj.save && obj.save_more that should get looked at. |
Iirc, the 'save_upload and save' pattern is because those two operations can logically be done independently of each other, and the upload has to be saved before the main record makes any sense to save... |
If you have a nested association, then the saving the parent model will save the nested records as well atomically, which usually the pattern we want. |
For some reason I recall that not working. I don't remember the details, though. I think it's because the has_one versus belongs_to relationships don't work in our favor here. |
I got it working in for backwards belongs_to for the course form. You need the "accepts_nested_attributes_for" thing in the model and to get the .permit thing right in the controller. |
These have been mostly eliminated. The only places they remain are for submissions (where we pass along a I've forced this to work for assignment uploads, where starter-file uploads now need to know their assignment id, and assignments need to know their starter-file uploads, and this kind of cyclic dependency is a pain to deal with. (This was the major sticking point for save_upload && save pattern.) But the benefits outweighed the downsides: now, all uploads related to a course are in one directory; all uploads related to a single assignment are within a subdirectory of that. The |
Trying to edit weights for all assignments breaks the current code an…
I should be able to delete more than half the controller code.
The text was updated successfully, but these errors were encountered: