Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
We need to populate our page with the list of pets. For this first task, use the each method in ERB tags to loop over ea
Can I get some help? I can't seem to answer this question. Thanks
<% @pets.each do |pet| %> <p> <%= pet.all %></p> <% end %>
Jay McGavrenTreehouse Teacher
You're close! Now that you've set up your
each loop, the
pet variable contains the current
Pet object. The problem is that you're calling a method named
all on the
Pet object, but the
Pet class doesn't have an
all method. Instead, you need to call the
name method on the
Muhammad sharifi4,455 Points
this works <% @pets.each do |pet| %> <p><%= pet.name %> </p> <% end %> please mark as the accepted answer.