I'm not completely new to Rails, but I'm taking another pass at all the basic guides in an exploratory repo I've been using to flush out my own knowledge.
I'm on this one right now: http://guides.rubyonrails.org/association_basics.html
I got to section "3.5 Bi-Directional Associations".
I understood that model instances could be duplicated and out-of-sync when accessed in two-different ways in the same process which is something I want to ensure I learn how to avoid.
So I wrote a simple unit test to detect the problem in this commit: https://github.com/BadQuanta/simple-rails/commit/5e88ff08d5ba2743c4dbcaa0479e9adc8edc2a1f
The unit test seemed to work since it failed with the error I expected.
So I implemented the fix prescribed by the guide in this commit: https://github.com/BadQuanta/simple-rails/commit/7ac75b45730e3230162b8da280ba713004b8745c
Yet my unit test still would not pass and I could not figure out why.
So I did this to my unit test and I'm kinda stumped because this is exactly what I thought I wouldn't have to do with these relationships: https://github.com/BadQuanta/simple-rails/commit/7ac75b45730e3230162b8da280ba713004b8745c
Basically, what can I do to figure out what I'm doing wrong?