I hadn't planned on covering testing on these since there are already some videos on the topic. https://www.driftingruby.com/episodes?query%5Bname%5D=&tag=test
However, I'll gladly add this episode in if the community would like to see them.
In this example where users may already exist, I would have a rake task which would populate the tokens for the users. Once the tokens have been generated, I would have another migration which would set the column to a `null: false`.
But I believe your confusion is valid as it should be `unless` instead of `if`.
`break if self.class.exists?(token: token)` would cause an endless loop while `break unless self.class.exists?(token: token)` would give the desired functionality.
Try setting the domain and use the url to https://note-book-diary.herokuapp.com/
So you'd need to update the host and the domain settings. You can check the Certificate within Chrome to see what the common name (or domain name) to see where the mismatch is.
Hello Steve, it really is the code organization which benefits from extracting the methods out. I've worked on similar applications in terms of size as the GitLab app and the fat models made it very difficult to work on. Grouping and moving ideas, like the friendships in the episode example, make the overall maintenance of the model easier over time. Yes, things are now in multiple files, but it ended up still being preferred over a large model. Ultimately, it does come down to the team's preference and their style of coding in which case I think should always be consistent on a per project basis. However, bringing a new person on board, it would be overwhelming to have to work in a large model like GitLab's user model. I consider most things, with exceptions, which makes something easier to maintain, lowering technical debt.