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

Dan Flynn
Dan Flynn
2,032 Points

Stuck on ERB basics code challenge

This is really embarrassing but I just don't understand what I'm supposed to do here the instruction says "Loop through our statuses array in an ERB template. Assume we have statuses set up as an array and want to print out the name."

and the code given is

<% @statuses.each do |status| %>
  Name: <br />
<% end %>

I listened attentively to the whole video before the code challenge and I'm kind of disheartened that I have no idea what it's asking me to do, if someone could explain this to me that would be greatly appreciated

1 Answer

Chris McKnight
Chris McKnight
11,045 Points

The challenge wants you to output the name attribute of each status object. In erb you use <%= to output something. In this case, you want to use <%= status.name %>.