Jared Armes6,242 Points
Appending to an array inside of a variable
Perhaps I am just misreading the challenge title, but they want me to append "contact" to the "contacts" array within the "address_book" variable. How is this possible, when they never asked me to define an instance of the "contacts" array? I tried this a couple of different ways but couldn't seem to figure it out. Any assistance at all would be appreciated; like I said, I feel that I may just be incorrectly interpreting the challenge.
contact = Contact.new contact.first_name = "My" contact.last_name = "Name" address_book = AddressBook.new contacts =  contacts.push(contact)
Tim KnightTreehouse Moderator 28,849 Points
Jared, the contacts array would be within the address_book object.
address_book = AddressBook.new address_book.contacts << contact
You could also do using
push below, but I prefer using << as a shorthand was to append.
address_book = AddressBook.new address_book.contacts.push(contact)