Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
PLUS
William Li
Courses Plus Student 26,868 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")