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

Adriana Cabrera
Adriana Cabrera
14,618 Points

Challenge Task 1 of 2 The index action method on the PetsController includes the following code:

Challenge Task 1 of 2 The index action method on the PetsController includes the following code:

def index @pets = Pet.all end 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 each of the Pet objects.

1 Answer

Adriana Cabrera
Adriana Cabrera
14,618 Points

I just want to share my answer with the community. Task1 and Task2 <% @pets.each do |pet| %> <p><%= pet.name %></p> <% end %>