school = School.new('Flatiron School') school.students => ["Isaac", "Caroline", "Zahran"]
school = School.new('Flatiron School') school.students => [<Student @name="Isaac">, , ]
student = Student.new('Isaac', School.new('Flatiron School')) student = Student.new(String.new('Isaac'), School.new('Flatiron School')) student.school
- Object relationships, has many/belongs to
- Single source of truth
- Create a User class. A user should initialize with a username and have a reader and writer method for the username. A user should have a method called
#tweets
that returns an array of Tweet instances. - Create a Tweet class. A tweet should have a method called
#message
that points to a string and#user
that points to an instance of the user class. It should have a method called.all
that returns all the Tweets created. - Tweet instances should respond to a message called
#username
that returns the username of the tweet's user. - User instances should respond to a method called
#post_tweet
that takes in a message, creates a new tweet and adds it to that user's collection.