Forum: Ruby on Rails Link_to with anchor?

Ecf21acef6f0e0d734051c7392207d2f?d=identicon&s=25 Nauhaie None (nauhaie)
on 2006-09-15 15:14
Hi!

Very silly question, but how do you use link_to with an anchor, for
example:

www.website.com/articles/123#comments ?

Just can't figure out!

Thank you!
D68c82f7c95fbfb6d50d62cbfa0d8409?d=identicon&s=25 Curtis Summers (curtissummers)
on 2006-09-15 15:48
Nauhaie None wrote:
> Hi!
>
> Very silly question, but how do you use link_to with an anchor

link_to 'mylink', {:controller => â??postsâ??,
                   :action => â??showâ??,
                   :id => 10,
                   :anchor => â??commentsâ??}


From the url_for documentation:
:anchor â?? specifies the anchor name to be appended to the path. For
example, url_for :controller => â??postsâ??, :action => â??showâ??, :id => 10,
:anchor => â??commentsâ?? will produce "/posts/show/10#comments".
Ecf21acef6f0e0d734051c7392207d2f?d=identicon&s=25 Nauhaie None (nauhaie)
on 2006-09-15 15:50
Nice! Thanks a lot!
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.