I’m currently doing Flatiron’s online program. The parts dealing with object-oriented Ruby, and especially labs dealing with the kinds of topics your article covers, have been giving me the most difficulties. In some cases, I never would have solved them without looking up solutions online. Anyhow…
For the Car_Owner class in this exercise you describe, should we include an “attr_reader :name” at the top? Here’s what I wrote at the top of my code for the class:
attr_reader :name
@@all = []
def initialize(name)
@name = name
@@all << self
end
I’m still trying to figure out how classes and “has many” and “has many through” all work together.