On Dec 5, 5:30 am, Daniel <cho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I have one problem when I create the index page.
>
> I have wrote following in index.html.erb:
>
> <h2> All Blogs</h2>
> <ul>
> <% @weblogs.each do |page| %>
> <li>
> <%= link_to page.title, weblog_path(@weblogs) %>
> </li>
> <% 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
collection
Fred
> But when I''ve created the second item, the url of both 2, became
like
> thishttp://localhost:3000/weblogs/1/2
>
> How can I solve this problem, I want the item No.1
ishttp://localhost:3000/weblogs/1
> and item No.2 should behttp://localhost:3000/weblogs/2
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---