You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 6, 2021. It is now read-only.
and the Build model adds the last commiter to the collaborations:
after_save:add_last_commiter_to_collaborations
However, the BuildsController could also look up the collaborations membership (instead of doing this in the model), and add it if required:
@build.project.users << @build.last_commiter
Similarly, the model could check for the last commiter user account and create one if required.
How to make decisions about which components (controllers vs. models) should be responsible for which logic?
One problem with the BuildsController manipulating the collaborations is that we don't want the collaborations list altered until after the Build has been saved (known to be valid, etc.) ; suggesting this logic belongs in a model callback.
The text was updated successfully, but these errors were encountered:
The controller should never contain any logic. If you think some logic shouldn't belong to the model either, you might wanna create a "service" that does it for you which will be the glue between your models.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When a build is created, we:
At the moment, the BuildsController sets up the last commiter:
and the Build model adds the last commiter to the collaborations:
However, the BuildsController could also look up the collaborations membership (instead of doing this in the model), and add it if required:
Similarly, the model could check for the last commiter user account and create one if required.
How to make decisions about which components (controllers vs. models) should be responsible for which logic?
One problem with the BuildsController manipulating the collaborations is that we don't want the collaborations list altered until after the Build has been saved (known to be valid, etc.) ; suggesting this logic belongs in a model callback.
The text was updated successfully, but these errors were encountered: