1

i'm just started making blog via RoR, using blog-from-scratch guide and i've got some unexpected content on my index page. Here is the picture: http://i.minus.com/ibpnYRmlPv7IW3.png Some hash-like string under the title is that unexpected thing.

index_page code:

<h1>Recent posts</h1>
<table>
    <tr>
        <th>Title</th>
        <th>Text</th>
   </tr>

   <%= @posts.each do |post| %>
        <tr>
            <td style="border: solid 2px;"><%= post.title %></td>
            <td style="border: solid 2px;"><%= post.text %></td>
       </tr>
   <% end %>    
</table>


<%= link_to 'New post', :action => :new %>

Code part from PostsController:

def index
    @posts = Post.all
end

First i thought that was kind a time stamp from Db, but here is
code from migrate:

class CreatePosts < ActiveRecord::Migration
  def change
    create_table :posts do |t|
      t.string :title
      t.text :text
    end
  end
end

So now any help will be appreciated.

Jean-Rémy Revy
  • 5,607
  • 3
  • 39
  • 65

1 Answers1

1

Change

<%= @posts.each do |post| %>

to

<% @posts.each do |post| %>

What you're seeing is @posts.to_s output at the top of the screenshot from the

<%= @posts...
deefour
  • 34,974
  • 7
  • 97
  • 90