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.

Ruby Build a Simple Ruby on Rails Application Frontend Development ERB Basics

Having some trouble completing this code challenge.

Not sure of what this question is describing.

1 Answer

Gavin Ralston
Gavin Ralston
28,770 Points

In the video prior to this challenge it'll go over the template syntax and how to drop into and out of the HTML output by surrounding ruby code with tags.

So for instance:

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

Those two opening and closing commands there, they're never displayed anywhere in the HTML at all, right? They're just there so you can "drop in" to ruby and execute a loop, which DOES output the following for each status in statuses:

Name: <br/>

So the question here is... how do you drop back into ruby for a moment after the "Name: " part and have the information actually display to the page?

You'll want to use the opening tag with an equal sign in front of it, to indicate the output should be put into your page, not just run in the background

<%= "Stuff to be on HTML page" %>


<% @students.each do |student| %>
  Grade: <%= student.gpa %> <br />
<% end %>

Hope that helps a bit.