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 %>
<%= link_to 'Show', article %> |
<%= link_to 'Edit', edit_article_path(article) %> |
<%= link_to 'Destroy', article, :confirm => 'Are you sure?',
:method => :delete %> |
<% end %>
Thanks for any help
assuming that the articles table has a title field, then
<% @articles.each do |article| %>
<%= article.title %>
<% 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