Josh Cameron
Joined
10 Experience
0 Lessons Completed
0 Questions Solved
Activity
My understanding is that the method set_refferal_code that generates the code in the first place is ensuring that the code is unique. It will keep generating new codes, until it makes a unique one. I also found this article pretty helpful to learn about before and after methods. https://guides.rubyonrails.org/active_record_callbacks.html