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

Three different questions please help!

The first one is to this link.

http://teamtreehouse.com/library/build-a-simple-ruby-on-rails-application/frontend-development/erb-basics

I have no clue what to do there.

Second, is this p tag is not working. It brings the webpage to an error.

<p> <%= status.content %> </p>

Third, I have no clue why I am getting this wrong please help.

http://teamtreehouse.com/library/build-a-simple-ruby-on-rails-application/frontend-development/erb-loops

2 Answers

On the first one, they are asking you to output the name of each status. The <%= %> erb tags are what you place around your code to get it to output to the web page, as follows:

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

As to your second question, I'm not sure what you're referring to regarding p.

For your third question, the challenge is done in three parts, each building on the last. Step 1 wants you to loop through the statuses, which you would do like this:

<% @statuses.each do |status| %>
  <div class="status">
    <h2></h2>
    <p></p>
  </div>
<% end %>

Step 2 asks you to output the name. they don't specify it, but it looks like the name is supposed to go into the h2 tag. So now your code should look like this:

<% @statuses.each do |status| %>
  <div class="status">
    <h2><%= status.name %></h2>
    <p></p>
  </div>
<% end %>

Finally, step 3 asks you to output the content, so that would go in the p tag. The final code block looks like this:

<% @statuses.each do |status| %>
  <div class="status">
    <h2><%= status.name %></h2>
    <p><%= status.content %></p>
  </div>
<% end %>

Hope that helps.

This part on the webpage is giving me errors on the regular webpage.

<p><%= status.content %></p>

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

1 - Code:

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

Did you watch the videos and do you understand them? Please watch them as many times as you need to understand the content and experiment on your won machine with it.

2 - There are 3 challenges, not sure which one you mean.