Forum: Ruby on Rails Problems on "link_to"

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jette C. (Guest)
on 2008-12-05 07:31
(Received via mailing list)
I have one problem when I create the index page.

I have wrote following in index.html.erb:

<h2> All Blogs</h2>
  <% @weblogs.each do |page| %>
      <%= link_to  page.title, weblog_path(@weblogs) %>
   <%  end %>

and, at first, I create on item and it's url like this
It just works fine for me.

But when I've created the second item, the url of both 2, became like
this http://localhost:3000/weblogs/1/2

How can I solve this problem, I want the item No.1 is
and item No.2 should be http://localhost:3000/weblogs/2
Frederick C. (Guest)
on 2008-12-05 11:03
(Received via mailing list)
On Dec 5, 5:30 am, Daniel <removed_email_address@domain.invalid> wrote:
>    <%  end %>
> </ul>
> and, at first, I create on item and it's url like thishttp://localhost:3000/weblogs/1
> It just works fine for me.
Well the argument you're passing to weblog_path is the entire
collection of weblogs which doesn't seem right (especially when you've
already got a variable page that will iterate over the members of that

This topic is locked and can not be replied to.