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

Can't get statuses to appear on profiles controller

I am currently on the "testing the profiles controller" exercise on "building a simple ruby on rails app" learning adventure.

I am having a problem because when I write the code to display the "statuses" (In my application I call them logs) it displays the html or the console information instead of the proper front end display with the image, and bootrap customization.

here is what is displayed when I run my app:

Log id: 1, description: "einstein", created_at: "2013-11-26 06:09:06", updated_at: "2013-11-26 06:09:06", user_id: 1, image_file_name: "93434191-einstein-tongue_custom-36fb0ce35776dc2d92e...", image_content_type: "image/jpeg", image_file_size: 52317, image_updated_at: "2013-11-26 06:09:03"

Here is the code I wrote in the profiles/show page:

<%= @user.username%>

<% @logs.each do |log| %> <%= log.inspect %> <% end %>

the log.content command doesn't work for me like in the lesson.

Any help would be appreciated!

4 Answers

What's log.inspect? Looking at your sample Log with id = 1, there is no inspect column in the database. Is this a method in your log model?

No I had researched a solution on stackoverflow and someone suggested to use inspect so I just tried it since the .content method didn't work

You want log.description then since description is the column in your database explaining log.

the log.description command doesn't work for me either :/ it still displays incorrectly.

the log.description command doesn't work for me either :/ it still displays incorrectly.

I get the following output: undefined method `description' for #<ActiveRecord::Relation::ActiveRecord_Relation_Log:0x007ffe68f49958>