Link_to with anchor?

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!

Nauhaie N. 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”.

Nice! Thanks a lot!