Ruby on Rails Saturday, February 4, 2012

hi, this is what i have now done, dont know why i didnt think if this
earlier. However i now have the following issue.

im my private_pages controller i have

def news

@post = Post.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.json { render json: @post }
end
end

in my private_pages/news view i have

<body id="contact">
<h1 class="news">Bafo News</h1>

<font size="3" face="arial" color="white">

<table>
<tr>
<th>Title</th>
<th>Body</th>
<th></th>
<th></th>
<th></th>
</tr>

<% @posts.each do |post| %>
<tr>
<td><%= post.title %></td>
<td><%= post.body %></td>
</tr>
<% end %>
</table>

<br />

</body>


When i try and view the private_pages/news page i get this error message

ActiveRecord::RecordNotFound in PrivatePagesController#news

Couldn't find Post without an ID

Any ideas?

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment