This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/refactoring-todo-completions
Should the model itself be responsible for reload
-ing in Todo#complete!
? It feels wrong that an outsider would have to concern themselves with calling todo.reload
to make sure it has the new data.
On the other hand, maybe that’s a superfluous query if the todo
object is no longer used after this, but rather reloaded on the next request. Is there a way to lazy reload?
I think todo.reload
is not really necessary in the test, since the touch
method seems to have reloaded the record.