Ruby Build an Address Book in Ruby Search Searching By Address

Mark Weinberg
Mark Weinberg
3,002 Points

Call the find_by_address method on the address_book instance and send it any address.

I am having trouble with my code for Challenge Task 1 of 1 for "Call the find_by_address method on the address_book instance and send it any address". Can someone show me the correct code so I can see what I am doing wrong?

address_book.rb
contact = Contact.new
contact.first_name = "My"
contact.last_name = "Name"

class AddressBook

  def initialize
    address_book = AddressBook.new
  end



end

address_book(123 spring drive)

1 Answer

William Li
PRO
William Li
Pro Student 26,799 Points

Hi, Mark, this challenge is actually pretty simple, you do NOT need to reopen the AddressBook class.

address_book = AddressBook.new
address_book.find_by_phone_number "123-456-7890"

# use the dot notation to access the given method on the 'address_book' object
# then pass in any address as argument to the method call
address_book.find_by_address("1234 AnyAddress Ave New York, NY")