Commit graph

5 commits

Author SHA1 Message Date
GitLab Bot
aeda2f64b4 Add latest changes from gitlab-org/gitlab@master 2022-03-16 09:08:20 +00:00
GitLab Bot
5b829393a7 Add latest changes from gitlab-org/gitlab@master 2021-06-14 21:10:22 +00:00
GitLab Bot
6a3c4476fa Add latest changes from gitlab-org/gitlab@master 2021-04-19 15:09:08 +00:00
GitLab Bot
89cd4b4101 Add latest changes from gitlab-org/gitlab@master 2021-03-31 03:09:00 +00:00
Yorick Peterse
38b8ae641f
Clean up ActiveRecord code in TodoService
This refactors the TodoService class according to our code reuse
guidelines. The resulting code is a wee bit more verbose, but it allows
us to decouple the column names from the input, resulting in fewer
changes being necessary when we change the schema.

One particular noteworthy line in TodoService is the following:

    todos_ids = todos.update_state(state)

Technically this is a violation of the guidelines, because
`update_state` is a class method, which services are not supposed to use
(safe for a few allowed ones). I decided to keep this, since there is no
alternative. `update_state` doesn't produce a relation so it doesn't
belong in a Finder, and we can't move it to another Service either. As
such I opted to just use the method directly.

Cases like this may happen more frequently, at which point we should
update our documentation with some sort of recommendation. For now, I
want to refrain from doing so until we have a few more examples.
2018-10-08 15:19:12 +02:00