Ruby on Rails Thursday, February 19, 2015


I'm with a problem using link_to.
This is my code:


<h1>Listing articles</h1>
 <%= link_to 'My Blog', controller: 'articles' %>
 <%= link_to 'New article', new_article_path %>
<table>
<tr>
   <th>Title</th>
   <th>Text</th>
  </tr>
  <% @articles.each do |article| %>
  <tr>
  <td><%= link_to article.title, articles_path(article)  %></td>
  <td><%= article.text %></td>
  <td><%= article.id%></td>
  </tr>
  <% end %>
</table>

so this back links as " http://localhost:3000/articles.2 " instead of "http://localhost:3000/articles/2" .  What should I do? I am new to ruby on rais

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c3deb226-764e-474b-9a28-c025db968b6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment