Error in link_to

I’m with a problem using link_to.

This is my code:

Listing articles

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

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

On Thursday, February 19, 2015 at 10:25:43 AM UTC, Bruno Oliveira wrote:

<%= link_to article.title, articles_path(article) %> > > That should be article_path(article) (note the singular). articles_path returns the path for the collection as a whole. It's not expecting an article so ends up interpreting as the format it should link to, which is why it links to articles.2

Fred

My God! it works!

Thank you Fred, you’re my new superhero.

Em quinta-feira, 19 de fevereiro de 2015 08:35:37 UTC-2, Frederick
Cheung
escreveu: