I don’t mean how do I include ActiveRecord, but let me explain.
I want to have a Game with a difficultyLevelID and a DifficultyLevel Object.
In Rails and ActiveRecord (that’s what I am familiar with) these would be tables and I would have the has_many and belongs_to methods and then I could just use the difficultyLevelID to get things, so difficulty level could be Game.difficulty_level.name
If I am just doing a Ruby program with no database and I want to use that relationship, i.e. I want Game to have an ID for difficulty level and the level name itself to be in a difficulties class, how do I do that (create, maintain and query the relationship) just with Ruby so that I can say get the game difficulty level name?
There was no answer in 20 hours so I’ve posted my own.
and of course the tests: