Daniel Brownlow Daniel Brownlow - 1 year ago 123
Ruby Question

Michael Hartl - Chapter 2

I've been going through Chapter 2 and it's been going well, except that he's asked the reader to show the users first micropost, which seems simple. You can see the Chapter here.

In my

I've added the following lines:

<p id="notice"><%= notice %></p>

<%= @user.name %>

<%= @user.email %>

<%= @user.microposts.first %>

<%= link_to 'Edit', edi<p id="notice"><%= notice %></p>

But all I see at /users/1 is "Post: #".

Any idea what I'm doing wrong?

Thank you.

Answer Source

<%= @user.microposts.first %> returns a single post object. to render content do this

<%= @user.microposts.first.content %>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download