Forum: Ruby on Rails simple dumb rails from datastore question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D13563098fc07b07400f833c4e6e7169?d=identicon&s=25 Roger Reeks (cogrady2k)
on 2008-10-22 11:44
hi, ive just started learning rails and im trying to make a simple blog
app

i have the following code on my index page

i can add articles ok but i cant display them

everything ive tried to put between the h1 tags fails?
what should I put between the tags to display the data stores in the
body and title fields

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

<% for article in @articles %>
  <tr>
<h1>

</h1>
    <td><%= link_to 'Show', article %></td>
    <td><%= link_to 'Edit', edit_article_path(article) %></td>
    <td><%= link_to 'Destroy', article, :confirm => 'Are you sure?',
:method => :delete %></td>
  </tr>
<% end %>

Thanks for any help
2d8132658d56e51f19ace1c68e48b6aa?d=identicon&s=25 Thorsten Mueller (thorsten)
on 2008-10-22 12:33
(Received via mailing list)
assuming that the articles table has a title field, then

<% @articles.each do |article| %>
  <h1> <%= article.title %> </h1>
<% end %>

would display it.

But if I remember right, H1 tags within a table are not valid html
You would have to put them into a TD tag I think. Maybe your
code was right and your browser didn't display it for that
reason
This topic is locked and can not be replied to.