# \[Rails Guides\] Getting Started 7.4 - Array Output Problem

**URL:** <https://discuss.rubyonrails.org/t/rails-guides-getting-started-7-4-array-output-problem/63164>\
**Category:** rubyonrails-talk\
**Created:** [March 7, 2012, 12:04pm UTC](https://discuss.rubyonrails.org/t/rails-guides-getting-started-7-4-array-output-problem/63164 "2012-03-07T12:04:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoobyOnRails](https://avatars.discourse-cdn.com/v4/letter/n/e36b37/32.png) [@NoobyOnRails](https://discuss.rubyonrails.org/u/NoobyOnRails)\
**Post date:** [March 7, 2012, 12:04pm UTC](https://discuss.rubyonrails.org/t/rails-guides-getting-started-7-4-array-output-problem/63164/1 "2012-03-07T12:04:39Z")

</div>

Hey Guys, i'm new on rails and started with the Rails Guide: Getting Started with Rails

> **[Getting Started with Rails — Ruby on Rails Guides](https://guides.rubyonrails.org/getting_started.html)**
>
> Getting Started with RailsThis guide covers getting up and running with Ruby on Rails.After reading this guide, you will know: How to install Rails, create a new Rails application, and connect your application to a database. The general layout of a...

In section 7.4 I have a problem. I implemented the code as stated and when I add a comment it works fine. When I want to show the comment I get the following output under my comment:

[#\<Comment id: 1, commenter: "Tester", body: "This is a test comment", post\_id: 1, created\_at: "2012-03-07 11:48:02", updated\_at: "2012-03-07 11:48:02"\>]

Can somebody tell me where this come from?

---

<div class="post-metadata">

**Author:** ![Javier\_Quarite](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@Javier\_Quarite](https://discuss.rubyonrails.org/u/Javier_Quarite)\
**Post date:** [March 8, 2012, 7:37am UTC](https://discuss.rubyonrails.org/t/rails-guides-getting-started-7-4-array-output-problem/63164/2 "2012-03-08T07:37:46Z")

</div>

Could you post the code of the show.html.erb? (because you’re saying that it happens in the “show” action)

Javier Q.

---

<div class="post-metadata">

**Author:** ![Michael\_Pavling](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@Michael\_Pavling](https://discuss.rubyonrails.org/u/Michael_Pavling)\
**Post date:** [March 8, 2012, 8:15am UTC](https://discuss.rubyonrails.org/t/rails-guides-getting-started-7-4-array-output-problem/63164/3 "2012-03-08T08:15:37Z")

</div>

You're possibly doing this:

\<%= @my\_object.comments.each do |comment| %\> .... # and then code to output the comment \<% end %\>

rather than:

\<% @my\_object.comments.each do |comment| %\> .... # and then code to output the comment \<% end %\>

The equals sign before the iterator will output to the browser the result of the iterator (which will be the collection that's iterated). You can see the Comment displayed has square brackets around it, which indicate it's a single element array - so probably a collection that's being rendered by mistake.

---

<div class="post-metadata">

**Author:** ![NoobyOnRails](https://avatars.discourse-cdn.com/v4/letter/n/e36b37/32.png) [@NoobyOnRails](https://discuss.rubyonrails.org/u/NoobyOnRails)\
**Post date:** [March 8, 2012, 9:16am UTC](https://discuss.rubyonrails.org/t/rails-guides-getting-started-7-4-array-output-problem/63164/4 "2012-03-08T09:16:15Z")

</div>

Thats the point! Thank you so much!
