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

Why is this not working?

I need help with this code.

<div class="page-header">

  <h1> SINNERS Statuses </h1>

</div>

<% @statuses.each do |status| %>

  <div class="status">

    <strong> <%= status.name %> </strong>

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

  </div>

<% end %>

This part is giving me errors and is stopping me from learning.

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

The link to the instructors video is right here.

http://teamtreehouse.com/library/build-a-simple-ruby-on-rails-application/frontend-development/updating-the-index-page

2 Answers

There you go, that should answer your question. You don't have a member named "content" in your "status" class. Sorry, I don't know how your code is structured, I just assume that they are missing what you are trying to access.

Well, I give up, this is too hard, as I was instructed to install devise, once installed they had told me to delete a particular file Ruby terminal failed, crashed then saved and lost all my progress.

Sorry to hear that, I thought that you were working through the Ruby lesson, but it turned out that you are just at the beginning. Don't give up, maybe I did not lead you to the correct answer due to misunderstanding. You should freshly repost your question so that someone else will give it a try.

I think I am going to try to use Node.js to try and achieve what I was doing.

To pass the challenge, replace the "strong" tag with "h2" tag

<h2> <%= status.name %> </h2>

It is not a challenge. I am actually moving along with the video it self when I input the code it will give me an error for the webpage.

Here is a screenshot. http://gyazo.com/eea9f3128345bb559c1bd5cbda44597e

maybe because your "status" object does not have/contain the key named "content"? Just guessing according to the error.

So how would I go about resolving this error?

I have not taken this course, but I assume that each "status" object supposed to be constructed to include a key named "content" and a value for the key. Look in your object constructor to see if you have that.

I am sorry, but I have no clue what I am supposed to do.

What happens when you delete the line <p> <%= status.content %> </p>?

I looked in the project download files, it has this file to create the database structure for statuses (I added the // to keep the text from disappearing)

//class CreateStatuses < ActiveRecord::Migration

// def change

// create_table :statuses do |t|

// t.string :name

// t.text :content

// t.timestamps

// end

// end

//end

AND the status class

//class Status < ActiveRecord::Base

// attr_accessible :content, :name

//end

Each status in statuses has a field named "content". Your error message says that "content" is not defined, check if you forgot to include the field "content" when you followed along with the instruction.

Sorry, but I am completely bad at this, what do I do with that code? Which file do I look in, and what code do I make sure there is to determine if it is missing?

Hi, I was looking at the instructor's project file download. I am assuming that your project structure is the same. I don't know how you created your files, that is why I suggested that you look into those files.

What happens when you delete the line < p > < % = status.content % > < / p > from your code above, did the error go away?

The error does go away. However, I need this code to access their messages.