Problems on "link_to"


#1

I have one problem when I create the index page.

I have wrote following in index.html.erb:

All Blogs

    <% @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
http://localhost:3000/weblogs/1
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
http://localhost:3000/weblogs/1
and item No.2 should be http://localhost:3000/weblogs/2


#2

On Dec 5, 5:30 am, Daniel removed_email_address@domain.invalid wrote:

<% end %>

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
collection

Fred