Forum: Ruby on Rails Link_to _path instead of href?

Ec8b325dcad37dee7a0c358811353a80?d=identicon&s=25 wragen22 (Guest)
on 2012-11-01 21:06
(Received via mailing list)
hi There,
I'm wanting to link to a page - my index.html

I was thinking this would work, but it's not.  Any direction is
appreciated.

<li class="active"<%= link_to "Posts", posts_path %></li>

Thanks
1e08d48f2c4011e254f34dfb457811df?d=identicon&s=25 felipeclopes (Guest)
on 2012-11-01 21:54
(Received via mailing list)
It depends on what is defined in your routes.rb

If you defined the resource Post it shoul works

Otherwise, can you show us what is the error that is happening?

Regards,
Ec8b325dcad37dee7a0c358811353a80?d=identicon&s=25 wragen22 (Guest)
on 2012-11-01 22:13
(Received via mailing list)
I do have posts defined.

The links for some reason is out of place and un-clickable.

<https://lh5.googleusercontent.com/-lhjq5pWzWek/UJL...
Ec8b325dcad37dee7a0c358811353a80?d=identicon&s=25 wragen22 (Guest)
on 2012-11-01 22:15
(Received via mailing list)
Hmm..figured it out.

Changed to this and working now.

<li><%= link_to "Posts", posts_path %></li>
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2012-11-01 22:20
(Received via mailing list)
On 1 November 2012 21:14, wragen22 <bradwrage@gmail.com> wrote:
> Hmm..figured it out.
>
> Changed to this and working now.
>
> <li><%= link_to "Posts", posts_path %></li>

When you have that sort of issue but cannot immediately see the
problem a useful technique is to copy/paste the complete html source
of the page into the w3c html validator.  It will point out to you any
errors in the html, which was the problem that you had.

In fact it is worth doing it with each page even if it does look good,
you will often find that there are errors that you had not noticed.

Colin
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.