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 Ruby Collections Ruby Hashes Working with Hash Values

Dan Muscat
Dan Muscat
1,803 Points

why is the following code not passing grocery_item.has_value?("Bread") grocery_item.store("food", "true")

why is the following code not passing

grocery_item.has_value?("Bread")

grocery_item.store("food", "true")

hash.rb
grocery_item = { "item" => "Bread", "quantity" => 1, "brand" => "Treehouse Bread Company" }

1 Answer

Dan Muscat
Dan Muscat
1,803 Points

figure it out... true value is not a string..

grocery_item.has_value?("Bread")

grocery_item.store("food", true)

Jason Anders
Jason Anders
Treehouse Moderator 145,858 Points

Hey Dan, Glad you figured it out! :)

You can mark your own answers as "Best Answer." This will let others know that your question has been successfully resolved.

Keep Coding!